0 Votes

Changes for page SubmitIncidentMacro

Last modified by Ryan C on 2025/06/08 05:22

From version 2.8
edited by Ryan C
on 2025/06/08 03:46
Change comment: There is no comment for this version
To version 2.11
edited by Ryan C
on 2025/06/08 03:59
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,5 +1,4 @@
1 1  {{velocity}}
2 -
3 3  #set($headline = $wikimacro.parameters.headline)
4 4  #set($url = $wikimacro.parameters.url)
5 5  #set($desc = $wikimacro.parameters.description)
... ... @@ -15,19 +15,21 @@
15 15   #end
16 16  #end
17 17  
18 -## Build incident block line by line
19 -#set($block = "(% style=\"margin-bottom:20px; width:100%\" %)\n")
20 -#set($block = "${block}|[[image:${resolvedImage}||data-xwiki-image-style=\"thumbnail-clickable\" style=\"border:1px solid #ccc\" width=\"200\"]]| \n")
21 -#set($block = "${block}\n=== [[$headline>>$url]] ===\n\n")
22 -#set($block = "${block}$desc\n[[Read More>>$url]]")
17 +## Build incident block
18 +#set($incidentBlock = "(% class=\"incident-block\" %)\n")
19 +#if ($resolvedImage && $resolvedImage != "")
20 + #set($incidentBlock = "${incidentBlock}|[[image:${resolvedImage}||width=\"200\" style=\"border:1px solid #ccc\"]]| \n")
21 +#else
22 + #set($incidentBlock = "${incidentBlock}|No image provided.| \n")
23 +#end
24 +#set($incidentBlock = "${incidentBlock}\n=== [[$headline>>$url]] ===\n\n")
25 +#set($incidentBlock = "${incidentBlock}$desc\n[[Read More>>$url]]")
23 23  
24 -## Append to current page
27 +## Append to current document
25 25  #set($doc = $xwiki.getDocument($doc.fullName))
26 26  #set($content = $doc.getContent())
27 -$doc.setContent("${content}\n\n${block}")
30 +$doc.setContent("${content}\n\n${incidentBlock}")
28 28  $doc.save()
29 29  
30 30  <div class="xwiki-messages xwiki-successmessage">Incident added to this page.</div>
31 -
32 32  {{/velocity}}
33 -
XWiki.WikiMacroParameterClass[1]
Parameter description
... ... @@ -1,5 +3,1 @@
1 -
2 -
3 3  The source URL of the incident (link)
4 -
5 -