Changes for page Video Macro

Last modified by Ludovic Dubost on 2023/04/25 09:12

From version 1.1
edited by Ludovic Dubost
on 2017/02/15 10:55
Change comment: Install extension [org.xwiki.contrib:macro-video-1.11]
To version 4.1
edited by Ludovic Dubost
on 2018/11/30 15:24
Change comment: Migrated property [async_enabled] from class [XWiki.WikiMacroClass]

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -56,13 +56,18 @@
56 56   #if ("$!xcontext.macro.params.attachment" != '')
57 57   ## read a video attachement
58 58   #set($videoAttachmentName = $xcontext.macro.params.attachment)
59 - #if ($doc.getAttachment($videoAttachmentName))
59 + #set($videoAttachmentDoc = $doc)
60 + #set($videoAttachmentRef = $xcontext.macro.params.reference)
61 + #if("$!videoAttachmentRef" != '' && $services.security.authorization.hasAccess('view', $videoAttachmentRef))
62 + #set($videoAttachmentDoc = $xwiki.getDocument($services.model.resolveDocument($xcontext.macro.params.reference)))
63 + #end
64 + #if ($videoAttachmentDoc.getAttachment($videoAttachmentName))
60 60   #set($discard = $xwiki.jsx.use("Macros.Video20"))
61 61   #set($discard = $xwiki.ssx.use("Macros.Video20"))
62 - #set($videoURL = $doc.getAttachmentURL($videoAttachmentName))
67 + #set($videoURL = $videoAttachmentDoc.getAttachmentURL($videoAttachmentName))
63 63   #set($videoPoster = "")
64 - #if("$!xcontext.macro.params.videoPoster" != '' && $doc.getAttachment($xcontext.macro.params.videoPoster))
65 - #set($videoPoster = $doc.getAttachmentURL($xcontext.macro.params.videoPoster))
69 + #if("$!xcontext.macro.params.videoPoster" != '' && $videoAttachmentDoc.getAttachment($xcontext.macro.params.videoPoster))
70 + #set($videoPoster = $videoAttachmentDoc.getAttachmentURL($xcontext.macro.params.videoPoster))
66 66   #end
67 67   #set($supportedVideoFormats = ["mp4", "webm", "ogv", "mov", "avi", "mkv", "flv"])
68 68   #set($videoFormat = "")
XWiki.WikiMacroParameterClass[7]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Reference of a document in case of a video attachment.
Parameter name
... ... @@ -1,0 +1,1 @@
1 +reference