Änderungen von Dokument Button

Zuletzt geändert von xwikiadmin am 2025/05/21 09:56

Von Version 7.1
bearbeitet von xwikiadmin
am 2025/05/21 09:56
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.26.19]
Auf Version 2.1
bearbeitet von xwikiadmin
am 2023/04/25 11:27
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros/1.7.1]

Zusammenfassung

Details

Seiteneigenschaften
Übergeordnete Seite
... ... @@ -1,1 +1,1 @@
1 -WebHome
1 +xwiki:XWiki.Macros.WebHome
Versteckt
... ... @@ -1,1 +1,1 @@
1 -true
1 +false
Inhalt
... ... @@ -10,9 +10,6 @@
10 10  |width|$services.localization.render('rendering.macro.button.parameter.width.description')|-
11 11  |newTab|$services.localization.render('rendering.macro.button.parameter.newTab.description')|false
12 12  |icon|$services.localization.render('rendering.macro.button.parameter.icon.description')|-
13 -|type|$services.localization.render('rendering.macro.button.parameter.type.description')|Default
14 -|id|$services.localization.render('rendering.macro.button.parameter.id.description')|Default
15 -|class|$services.localization.render('rendering.macro.button.parameter.class.description')|Default
16 16  
17 17  == Examples ==
18 18  
... ... @@ -34,8 +34,4 @@
34 34  {{code}}{{button label="Store" url="http://store.xwiki.com" color="#889cb8" newTab="true" icon="page" width="100%"/}}{{/code}}
35 35  
36 36  {{button label="Store" url="http://store.xwiki.com" color="#889cb8" newTab="true" icon="page" width="100%"/}}
37 -
38 -{{code}}{{button label="Delete example" url="http://store.xwiki.com" type="DANGER"/}}{{/code}}
39 -
40 -{{button label="Delete example" url="http://store.xwiki.com" type="DANGER"/}}
41 41  {{/velocity}}
XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -32,9 +32,6 @@
32 32   #set ($width = $escapetool.xml($wikimacro.parameters.width))
33 33   #set ($newTab = $escapetool.xml($wikimacro.parameters.newTab))
34 34   #set ($icon = $escapetool.xml($xcontext.macro.params.icon))
35 - #set ($macro.id = $wikimacro.parameters.id)
36 - #set ($macro.classParam = $wikimacro.parameters.get('class'))
37 - #set ($macro.type = $wikimacro.parameters.type)
38 38   ## Resolve the url as a Wiki Document if it exists, else assume it is an external link
39 39   #if ($xwiki.exists($url))
40 40   #set ($url = $xwiki.getDocument($url).getURL())
... ... @@ -46,52 +46,37 @@
46 46   #else
47 47   #set ($colors = [255, 255, 255])
48 48   #end
49 - #set ($macro.additionalClass = '')
50 - #if ("$!macro.classParam" != '')
51 - #set ($macro.additionalClass = "$macro.additionalClass $macro.classParam")
52 - #end
53 - #if ("$!macro.type" != '')
54 - #set ($macro.additionalClass = "$macro.additionalClass btn-$macro.type.name().toLowerCase()")
55 - #end
56 56   #set ($darkenedColors = [])
57 57   #darken($colors, $darkenedColors)
58 58   {{html clean=false}}
59 - ## #124: The Button macro deletes followup content when inserted from wysiwyg
60 - ## Wrap the macro output inside a block element if the context where the macro is inserted is not inline, e.g. if the
61 - ## macro is inserted between paragraphs rather than between the text of a paragraph. Otherwise the generated HTML is
62 - ## invalid which breaks the WYSIWYG editing because the browser tries to fix the invalid HTML and messes up the macro
63 - ## output markers that protect the macro output.
64 - #if (!$wikimacro.context.isInline())<p>#end
65 65   <a href="$url" #if($newTab == 'true')target="_blank"#end>
66 66   <button
67 - #if ("$!macro.id" != '')
68 - id="$escapetool.xml($macro.id)"
69 - #end
70 70   style="
71 - #if ("$!color" != '')
72 72   background-color: #toCssRGB($colors);
73 73   border-color: #toCssRGB($darkenedColors);
74 74   color: #fontColor($colors);
75 - #end
76 76   width: $!width;
77 77   "
78 - class="btn $escapetool.xml($macro.additionalClass)">
57 + class="btn">
79 79   $!services.icon.renderHTML($!icon)
80 80   $label
81 81   </button>
82 82   </a>
83 - #if (!$wikimacro.context.isInline())</p>#end
84 84   {{/html}}
85 85  #end
86 86  {{/velocity}}
87 87  
66 +{{include reference="Licenses.Code.VelocityMacros"/}}
67 +
88 88  {{velocity}}
89 89  ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
90 90  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
91 91  ## don't have view right on those pages.
92 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
72 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
93 93   #executeMacro
94 94  #else
95 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}}
75 + {{error}}
76 + #getMissingLicenseMessage('proMacros.extension.name')
77 + {{/error}}
96 96  #end
97 97  {{/velocity}}
Makrobeschreibung
... ... @@ -1,0 +1,1 @@
1 +Insert a button!
XWiki.WikiMacroParameterClass[0]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +The label of the button.
XWiki.WikiMacroParameterClass[1]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +A link or a page reference.
XWiki.WikiMacroParameterClass[2]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +The color of the button.
XWiki.WikiMacroParameterClass[3]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +The width of the button specified in pixels, percentage or other valid CSS value (ex. 30px, 30%, 30em). If no value is specified, the width will be determined by the length of the label.
XWiki.WikiMacroParameterClass[4]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +Denotes whether the page will be opened in a new page or not.
XWiki.WikiMacroParameterClass[5]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +Icon associated with the button, placed before the label.
XWiki.WikiMacroParameterClass[6]
Parameter-Vorgabe
... ... @@ -1,1 +1,0 @@
1 -DEFAULT
Parameter-Name
... ... @@ -1,1 +1,0 @@
1 -type
Parameter-Typ
... ... @@ -1,1 +1,0 @@
1 -com.xwiki.macros.button.ButtonType
Parameter verpflichtend
... ... @@ -1,1 +1,0 @@
1 -Nein
XWiki.WikiMacroParameterClass[7]
Parameter-Name
... ... @@ -1,1 +1,0 @@
1 -id
Parameter-Typ
... ... @@ -1,1 +1,0 @@
1 -java.lang.String
Parameter verpflichtend
... ... @@ -1,1 +1,0 @@
1 -Nein
XWiki.WikiMacroParameterClass[8]
Parameter-Name
... ... @@ -1,1 +1,0 @@
1 -class
Parameter-Typ
... ... @@ -1,1 +1,0 @@
1 -java.lang.String
Parameter verpflichtend
... ... @@ -1,1 +1,0 @@
1 -Nein