Änderungen von Dokument MicrosoftStream

Zuletzt geändert von xwikiadmin am 2024/06/24 14:35

Von Version 1.1
bearbeitet von xwikiadmin
am 2022/08/11 17:57
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros/1.3]
Auf Version 2.1
bearbeitet von xwikiadmin
am 2023/04/25 10:54
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros/1.7.1]

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -2,7 +2,6 @@
2 2  = Description =
3 3  
4 4  The Microsoft Stream Macro provides a way for embeding a Microsoft Stream video in a page.
5 -This macro is also a bridge between the Confluence macro and XWiki.
6 6  
7 7  = Parameters =
8 8  
... ... @@ -41,6 +41,11 @@
41 41  $xwiki.currentContentSyntaxId)|$services.rendering.escape(
42 42  $services.localization.render('rendering.macro.microsoftStream.parameter.autoplay.description'),
43 43  $xwiki.currentContentSyntaxId)|No|false
43 +|**textWrap**|$services.rendering.escape(
44 +$services.localization.render('rendering.macro.microsoftStream.parameter.textWrap.name'),
45 +$xwiki.currentContentSyntaxId)|$services.rendering.escape(
46 +$services.localization.render('rendering.macro.microsoftStream.parameter.textWrap.description'),
47 +$xwiki.currentContentSyntaxId)|No|true
44 44  
45 45  {{/velocity}}
46 46  
... ... @@ -47,5 +47,5 @@
47 47  = Example of usage =
48 48  
49 49  {{code}}
50 -{{microsoftStream url="https://web.microsoftstream.com/video/2113" width="700px" alignment="left" showinfo="true" start="00:05:04"/}}
54 +{{msStream url="https://web.microsoftstream.com/video/2113" width="700px" alignment="left" showinfo="true" start="00:05:04"/}}
51 51  {{/code}}
XWiki.StyleSheetExtension[0]
Code
... ... @@ -5,6 +5,14 @@
5 5   text-align: center;
6 6   }
7 7  
8 + &-left {
9 + text-align: start;
10 + }
11 +
12 + &-right {
13 + text-align: end;
14 + }
15 +
8 8   iframe {
9 9   max-width: 100%;
10 10   border: none;
XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,11 +1,11 @@
1 1  {{velocity output="false"}}
2 -#macro (getAlignmentClass $alignment $alignmentClass)
3 - #if ($alignment == 'left')
4 - #set ($alignmentClass = 'pull-left')
5 - #elseif ($alignment == 'right')
6 - #set ($alignmentClass = 'pull-right')
2 +#macro (getStyle $alignment $textWrap $styleClass)
3 + ## For left and right alignment, consider if text should be wrapped around the video. If no value is set for textWrap,
4 + ## this will be false by default.
5 + #if ($alignment == 'left' || $alignment == 'right')
6 + #set ($styleClass = "#if ($textWrap == true)pull-${alignment}#{else}msStreamMacro-${alignment}#end")
7 7   #elseif ($alignment == 'center')
8 - #set ($alignmentClass = 'msStreamMacro-center')
8 + #set ($styleClass = 'msStreamMacro-center')
9 9   #end
10 10  #end
11 11  
... ... @@ -38,33 +38,48 @@
38 38   + $datetool.getValue('SECOND', $dateObj))
39 39   #end
40 40  #end
41 +
42 +#macro (executeMacro)
43 + #set ($discard = $xwiki.ssx.use('XWiki.Macros.MicrosoftStream'))
44 + #getStyle($stringtool.lowerCase($xcontext.macro.params.alignment) $xcontext.macro.params.textWrap $styleClass)
45 + #getBaseURLAndQueryParams($xcontext.macro.params.url $baseURL $queryParams)
46 + ## Update the query params, if needed, since macro parameters have priority over the parameters extracted from URL.
47 + #set ($autoplay = $xcontext.macro.params.autoplay)
48 + #if ($autoplay)
49 + #set ($discard = $queryParams.put('autoplay', $autoplay))
50 + #end
51 + #set ($showinfo = $xcontext.macro.params.showinfo)
52 + #if ($showinfo)
53 + #set ($discard = $queryParams.put('showinfo', $showinfo))
54 + #end
55 + #if ($xcontext.macro.params.start)
56 + #getStartAsSeconds($xcontext.macro.params.start $startSeconds)
57 + #if ($queryParams.st != $startSeconds)
58 + #set ($discard = $queryParams.put('st', $startSeconds))
59 + #end
60 + #end
61 + #set ($videoURL = $baseURL + '?' + $escapetool.url($queryParams))
62 + {{html clean=false}}
63 + <p class="msStreamMacro $!escapetool.xml($styleClass)">
64 + <iframe width="$escapetool.xml($xcontext.macro.params.width)"
65 + height="$escapetool.xml($xcontext.macro.params.height)" src="$escapetool.xml($videoURL)" allowfullscreen>
66 + </iframe>
67 + </p>
68 + {{/html}}
69 +#end
41 41  {{/velocity}}
42 42  
72 +{{include reference="Licenses.Code.VelocityMacros"/}}
73 +
43 43  {{velocity}}
44 -#set ($discard = $xwiki.ssx.use('XWiki.Macros.MicrosoftStream'))
45 -#getAlignmentClass($stringtool.lowerCase($xcontext.macro.params.alignment) $alignmentClass)
46 -#getBaseURLAndQueryParams($xcontext.macro.params.url $baseURL $queryParams)
47 -## Update the query params, if needed, since macro parameters have priority over the parameters extracted from URL.
48 -#set ($autoplay = $xcontext.macro.params.autoplay)
49 -#if ($autoplay)
50 - #set ($discard = $queryParams.put('autoplay', $autoplay))
75 +## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
76 +## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
77 +## don't have view right on those pages.
78 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
79 + #executeMacro
80 +#else
81 + {{error}}
82 + #getMissingLicenseMessage('proMacros.extension.name')
83 + {{/error}}
51 51  #end
52 -#set ($showinfo = $xcontext.macro.params.showinfo)
53 -#if ($showinfo)
54 - #set ($discard = $queryParams.put('showinfo', $showinfo))
55 -#end
56 -#if ($xcontext.macro.params.start)
57 - #getStartAsSeconds($xcontext.macro.params.start $startSeconds)
58 - #if ($queryParams.st != $startSeconds)
59 - #set ($discard = $queryParams.put('st', $startSeconds))
60 - #end
61 -#end
62 -#set ($videoURL = $baseURL + '?' + $escapetool.url($queryParams))
63 -{{html clean=false}}
64 - <p class="msStreamMacro $!escapetool.xml($alignmentClass)">
65 - <iframe width="$escapetool.xml($xcontext.macro.params.width)"
66 - height="$escapetool.xml($xcontext.macro.params.height)" src="$escapetool.xml($videoURL)" allowfullscreen>
67 - </iframe>
68 - </p>
69 -{{/html}}
70 70  {{/velocity}}
XWiki.WikiMacroParameterClass[3]
Parameter-Vorgabe
... ... @@ -1,0 +1,1 @@
1 +NONE
XWiki.WikiMacroParameterClass[7]
Parameter-Vorgabe
... ... @@ -1,0 +1,1 @@
1 +false
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +Wrap text around the video. This applies only to left and right alignment.
Parameter verpflichtend
... ... @@ -1,0 +1,1 @@
1 +Nein
Parameter-Name
... ... @@ -1,0 +1,1 @@
1 +textWrap
Parameter-Typ
... ... @@ -1,0 +1,1 @@
1 +java.lang.Boolean