Änderungen von Dokument Button
Zuletzt geändert von xwikiadmin am 2024/06/24 15:04
Von Version 5.1
bearbeitet von xwikiadmin
am 2024/06/24 15:04
am 2024/06/24 15:04
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]
Auf Version 1.1
bearbeitet von xwikiadmin
am 2022/08/11 17:55
am 2022/08/11 17:55
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros/1.3]
Zusammenfassung
-
Seiteneigenschaften (2 geändert, 0 hinzugefügt, 0 gelöscht)
-
Objekte (1 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- Seiteneigenschaften
-
- Übergeordnete Seite
-
... ... @@ -1,1 +1,1 @@ 1 -WebHome 1 +xwiki:XWiki.Macros.WebHome - Versteckt
-
... ... @@ -1,1 +1,1 @@ 1 - true1 +false
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -24,59 +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 ($url = $escapetool.xml($wikimacro.parameters.url)) 31 - #set ($color = $wikimacro.parameters.color) 32 - #set ($width = $escapetool.xml($wikimacro.parameters.width)) 33 - #set ($newTab = $escapetool.xml($wikimacro.parameters.newTab)) 34 - #set ($icon = $escapetool.xml($xcontext.macro.params.icon)) 35 - ## Resolve the url as a Wiki Document if it exists, else assume it is an external link 36 - #if ($xwiki.exists($url)) 37 - #set ($url = $xwiki.getDocument($url).getURL()) 38 - #end 39 - ## The color will be a java.awt.Color object 40 - ## Transform it into an array of Integers for better malleability: [x, y, z] 41 - #if ($color) 42 - #set ($colors = [$color.Red, $color.Green, $color.Blue]) 43 - #else 44 - #set ($colors = [255, 255, 255]) 45 - #end 46 - #set ($darkenedColors = []) 47 - #darken($colors, $darkenedColors) 48 - {{html clean=false}} 49 - ## #124: The Button macro deletes followup content when inserted from wysiwyg 50 - ## Wrap the macro output inside a block element if the context where the macro is inserted is not inline, e.g. if the 51 - ## macro is inserted between paragraphs rather than between the text of a paragraph. Otherwise the generated HTML is 52 - ## invalid which breaks the WYSIWYG editing because the browser tries to fix the invalid HTML and messes up the macro 53 - ## output markers that protect the macro output. 54 - #if (!$wikimacro.context.isInline())<p>#end 55 - <a href="$url" #if($newTab == 'true')target="_blank"#end> 56 - <button 57 - style=" 58 - background-color: #toCssRGB($colors); 59 - border-color: #toCssRGB($darkenedColors); 60 - color: #fontColor($colors); 61 - width: $!width; 62 - " 63 - class="btn"> 64 - $!services.icon.renderHTML($!icon) 65 - $label 66 - </button> 67 - </a> 68 - #if (!$wikimacro.context.isInline())</p>#end 69 - {{/html}} 70 -#end 71 71 {{/velocity}} 72 72 73 73 {{velocity}} 74 -## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right 75 -## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that 76 -## don't have view right on those pages. 77 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference)) 78 - #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]) 79 79 #else 80 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}}46 + #set ($colors = [255, 255, 255]) 81 81 #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}} 82 82 {{/velocity}}