Änderungen von Dokument Button
Zuletzt geändert von Thorsten Seifert am 2026/03/05 08:39
Von Version 11.1
bearbeitet von Thorsten Seifert
am 2026/03/05 08:39
am 2026/03/05 08:39
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.30.1]
Auf Version 1.1
bearbeitet von xwikiadmin
am 2022/08/11 17:57
am 2022/08/11 17:57
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros/1.3]
Zusammenfassung
-
Seiteneigenschaften (4 geändert, 0 hinzugefügt, 0 gelöscht)
-
Objekte (7 geändert, 0 hinzugefügt, 4 gelöscht)
- XWiki.WikiMacroClass[0]
- XWiki.WikiMacroParameterClass[0]
- XWiki.WikiMacroParameterClass[1]
- XWiki.WikiMacroParameterClass[2]
- XWiki.WikiMacroParameterClass[3]
- XWiki.WikiMacroParameterClass[4]
- XWiki.WikiMacroParameterClass[5]
- XWiki.WikiMacroParameterClass[6]
- XWiki.WikiMacroParameterClass[7]
- XWiki.WikiMacroParameterClass[8]
- XWiki.WikiMacroParameterClass[9]
Details
- Seiteneigenschaften
-
- Übergeordnete Seite
-
... ... @@ -1,1 +1,1 @@ 1 -WebHome 1 +xwiki:XWiki.Macros.WebHome - Dokument-Autor
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. seifertt1 +XWiki.xwikiadmin - Versteckt
-
... ... @@ -1,1 +1,1 @@ 1 - true1 +false - Inhalt
-
... ... @@ -7,13 +7,9 @@ 7 7 |label|$services.localization.render('rendering.macro.button.parameter.label.description')|- 8 8 |url|$services.localization.render('rendering.macro.button.parameter.url.description')|- 9 9 |color|$services.localization.render('rendering.macro.button.parameter.color.description')|White 10 -|title|$services.localization.render('rendering.macro.button.parameter.title.description')|- 11 11 |width|$services.localization.render('rendering.macro.button.parameter.width.description')|- 12 12 |newTab|$services.localization.render('rendering.macro.button.parameter.newTab.description')|false 13 13 |icon|$services.localization.render('rendering.macro.button.parameter.icon.description')|- 14 -|type|$services.localization.render('rendering.macro.button.parameter.type.description')|Default 15 -|id|$services.localization.render('rendering.macro.button.parameter.id.description')|Default 16 -|class|$services.localization.render('rendering.macro.button.parameter.class.description')|Default 17 17 18 18 == Examples == 19 19 ... ... @@ -35,8 +35,4 @@ 35 35 {{code}}{{button label="Store" url="http://store.xwiki.com" color="#889cb8" newTab="true" icon="page" width="100%"/}}{{/code}} 36 36 37 37 {{button label="Store" url="http://store.xwiki.com" color="#889cb8" newTab="true" icon="page" width="100%"/}} 38 - 39 -{{code}}{{button label="Delete example" url="http://store.xwiki.com" type="DANGER"/}}{{/code}} 40 - 41 -{{button label="Delete example" url="http://store.xwiki.com" type="DANGER"/}} 42 42 {{/velocity}}
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -24,85 +24,42 @@ 24 24 #fff 25 25 #end 26 26 #end 27 -#macro (executeMacro) 28 - ## Retrieve macro parameters 29 - #set ($label = $escapetool.xml($wikimacro.parameters.label)) 30 - #set ($title = $escapetool.xml($wikimacro.parameters.title)) 31 - #set ($url = $escapetool.xml($wikimacro.parameters.url)) 32 - #set ($color = $wikimacro.parameters.color) 33 - #set ($width = $escapetool.xml($wikimacro.parameters.width)) 34 - #set ($newTab = $escapetool.xml($wikimacro.parameters.newTab)) 35 - #set ($icon = $escapetool.xml($xcontext.macro.params.icon)) 36 - #set ($macro.id = $wikimacro.parameters.id) 37 - #set ($macro.classParam = $wikimacro.parameters.get('class')) 38 - #set ($macro.type = $wikimacro.parameters.type) 39 - ## Resolve the url as a Wiki Document if it exists, else assume it is an external link 40 - #if ($xwiki.exists($url)) 41 - #set ($url = $xwiki.getDocument($url).getURL()) 42 - #end 43 - ## The color will be a java.awt.Color object 44 - ## Transform it into an array of Integers for better malleability: [x, y, z] 45 - #if ($color) 46 - #set ($colors = [$color.Red, $color.Green, $color.Blue]) 47 - #else 48 - #set ($colors = [255, 255, 255]) 49 - #end 50 - #set ($macro.additionalClass = '') 51 - #if ("$!macro.classParam" != '') 52 - #set ($macro.additionalClass = "$macro.additionalClass $macro.classParam") 53 - #end 54 - #if ("$!macro.type" != '') 55 - #set ($macro.additionalClass = "$macro.additionalClass btn-$macro.type.name().toLowerCase()") 56 - #end 57 - #set ($darkenedColors = []) 58 - #darken($colors, $darkenedColors) 59 - {{html clean=false}} 60 - ## #124: The Button macro deletes followup content when inserted from wysiwyg 61 - ## Wrap the macro output inside a block element if the context where the macro is inserted is not inline, e.g. if the 62 - ## macro is inserted between paragraphs rather than between the text of a paragraph. Otherwise the generated HTML is 63 - ## invalid which breaks the WYSIWYG editing because the browser tries to fix the invalid HTML and messes up the macro 64 - ## output markers that protect the macro output. 65 - #if (!$wikimacro.context.isInline())<p>#end 66 - <a href="$url" #if($newTab == 'true')target="_blank"#end> 67 - <button 68 - #if ("$!macro.id" != '') 69 - id="$escapetool.xml($macro.id)" 70 - #end 71 - #if ("$!title" != "") 72 - title="$escapetool.xml($title)" 73 - #end 74 - style=" 75 - #if ("$!color" != '') 76 - background-color: #toCssRGB($colors); 77 - border-color: #toCssRGB($darkenedColors); 78 - color: #fontColor($colors); 79 - #end 80 - width: $!width; 81 - " 82 - class="btn $escapetool.xml($macro.additionalClass)"> 83 - #if ("$!icon" != "") 84 - #set ($iconHTML = "$!services.icon.renderHTML($icon)") 85 - #if ($iconHTML == "") 86 - <span class="fa fa-$escapetool.xml($icon)"></span> 87 - #else 88 - $iconHTML 89 - #end 90 - #end 91 - $label 92 - </button> 93 - </a> 94 - #if (!$wikimacro.context.isInline())</p>#end 95 - {{/html}} 96 -#end 97 97 {{/velocity}} 98 98 99 99 {{velocity}} 100 -## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right 101 -## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that 102 -## don't have view right on those pages. 103 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference)) 104 - #executeMacro 30 +## Retrieve macro parameters 31 +#set ($label = $escapetool.xml($wikimacro.parameters.label)) 32 +#set ($url = $escapetool.xml($wikimacro.parameters.url)) 33 +#set ($color = $wikimacro.parameters.color) 34 +#set ($width = $escapetool.xml($wikimacro.parameters.width)) 35 +#set ($newTab = $escapetool.xml($wikimacro.parameters.newTab)) 36 +#set ($icon = $escapetool.xml($xcontext.macro.params.icon)) 37 +## Resolve the url as a Wiki Document if it exists, else assume it is an external link 38 +#if ($xwiki.exists($url)) 39 + #set ($url = $xwiki.getDocument($url).getURL()) 40 +#end 41 +## The color will be a java.awt.Color object 42 +## Transform it into an array of Integers for better malleability: [x, y, z] 43 +#if ($color) 44 + #set ($colors = [$color.Red, $color.Green, $color.Blue]) 105 105 #else 106 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}}46 + #set ($colors = [255, 255, 255]) 107 107 #end 48 +#set ($darkenedColors = []) 49 +#darken($colors, $darkenedColors) 50 +{{html clean=false}} 51 +<a href="$url" #if($newTab == 'true')target="_blank"#end> 52 + <button 53 + style=" 54 + background-color: #toCssRGB($colors); 55 + border-color: #toCssRGB($darkenedColors); 56 + color: #fontColor($colors); 57 + width: $!width; 58 + " 59 + class="btn"> 60 + $!services.icon.renderHTML($!icon) 61 + $label 62 + </button> 63 +</a> 64 +{{/html}} 108 108 {{/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-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -com.xwiki.macros.button.ButtonType - Parameter verpflichtend
-
... ... @@ -1,1 +1,0 @@ 1 -Nein - Parameter-Vorgabe
-
... ... @@ -1,1 +1,0 @@ 1 -DEFAULT - Parameter-Name
-
... ... @@ -1,1 +1,0 @@ 1 -type
- 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
- XWiki.WikiMacroParameterClass[9]
-
- Parameter verpflichtend
-
... ... @@ -1,1 +1,0 @@ 1 -Nein - Parameter-Name
-
... ... @@ -1,1 +1,0 @@ 1 -title - Parameter-Typ
-
... ... @@ -1,1 +1,0 @@ 1 -java.lang.String