... |
... |
@@ -1,7 +1,64 @@ |
1 |
|
-## Compatibility patch: redirect {{expand}} to {{expandable}} |
2 |
|
-#set($start = ($expanded == "true") ? "expanded" : "collapsed") |
|
1 |
+{{velocity output="false"}} |
|
2 |
+#macro (executeMacro) |
|
3 |
+ ## To avoid an issue regarding {{wikimacroparameter}} and {{wikimacrocontent}} that fail to render when in |
|
4 |
+ ## edit mode while inside a HTML macro, we need to manually write the HTML by using XWiki syntax. This way, |
|
5 |
+ ## while the macro will always be expanded when in edit mode, the user will be able to modify the text inline. |
|
6 |
+ #set ($targetSyntaxId = $wikimacro.context.transformationContext.targetSyntax.type.id) |
|
7 |
+ #set ($discard = $xwiki.ssx.use('Confluence.Macros.Expand')) |
|
8 |
+ #if ($targetSyntaxId == 'annotatedhtml' || $targetSyntaxId == 'annotatedxhtml' || |
|
9 |
+ $request.outputSyntax == 'annotatedhtml') |
|
10 |
+ (% class="confluence-expand-macro panel panel-default" %) |
|
11 |
+ ((( |
|
12 |
+ ((( |
|
13 |
+ (% class="panel-title" %) |
|
14 |
+ ((( |
|
15 |
+ (% class="glyphicon glyphicon-menu-down" aria-hidden="true" %) |
|
16 |
+ ((())) |
|
17 |
+ {{wikimacroparameter name='title' /}} |
|
18 |
+ ))) |
|
19 |
+ ))) |
|
20 |
+ (% class="panel-body" %) |
|
21 |
+ ((( |
|
22 |
+ {{wikimacrocontent /}} |
|
23 |
+ ))) |
|
24 |
+ ))) |
|
25 |
+ #else |
|
26 |
+ #set ($opened = $xcontext.action == 'edit' || $xcontext.action == 'export' || $wikimacro.parameters.expanded) |
|
27 |
+ {{html clean="false" wiki="true"}} |
|
28 |
+ <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end> |
|
29 |
+ <summary> |
|
30 |
+ <span class="panel-title"> |
|
31 |
+ <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span> |
|
32 |
+ #set ($title = $wikimacro.parameters.title) |
|
33 |
+ #if ("$!title" == "") |
|
34 |
+ #set ($title = $services.promacroexpand.getAutoTitle($wikimacro.content, $xwiki.currentContentSyntaxId)) |
|
35 |
+ #if ("$!title" == "") |
|
36 |
+ #set ($title = $services.localization.render("rendering.macro.expand.defaultexpandtitle")) |
|
37 |
+ #end |
|
38 |
+ #end |
|
39 |
+ <span class="title-text"> |
|
40 |
+ $services.rendering.escape($escapetool.xml($title), $xwiki.currentContentSyntaxId) |
|
41 |
+ </span> |
|
42 |
+ </span> |
|
43 |
+ </summary> |
|
44 |
+ <div class="panel-body"> |
3 |
3 |
|
4 |
|
-{{expandable title="$!title" start="$start"}} |
5 |
|
-$!xcontext.macro.content |
6 |
|
-{{/expandable}} |
|
46 |
+ {{wikimacrocontent /}} |
7 |
7 |
|
|
48 |
+ </div> |
|
49 |
+ </details> |
|
50 |
+ {{/html}} |
|
51 |
+ #end |
|
52 |
+#end |
|
53 |
+{{/velocity}} |
|
54 |
+ |
|
55 |
+{{velocity}} |
|
56 |
+## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right |
|
57 |
+## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that |
|
58 |
+## don't have view right on those pages. |
|
59 |
+#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference)) |
|
60 |
+ #executeMacro |
|
61 |
+#else |
|
62 |
+ {{missingLicenseMessage extensionName="proMacros.extension.name"/}} |
|
63 |
+#end |
|
64 |
+{{/velocity}} |