0 Votes

Changes for page SubmitIncidentMacro

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

From version 2.10
edited by Ryan C
on 2025/06/08 03:52
Change comment: There is no comment for this version
To version 2.9
edited by Ryan C
on 2025/06/08 03:48
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -15,25 +15,20 @@
15 15   #end
16 16  #end
17 17  
18 -## Construct the block
19 -#set($builder = "")
20 -#set($builder = "${builder}(% style=\"margin-bottom:20px; width:100%\" %)\n")
21 -
22 -## Add image line
18 +## Build incident block
19 +#set($block = "(% style=\"margin-bottom:20px; width:100%\" %)\n")
23 23  #if ($resolvedImage && $resolvedImage != "")
24 - #set($builder = "${builder}|[[image:${resolvedImage}||data-xwiki-image-style=\"thumbnail-clickable\" style=\"border:1px solid #ccc\" width=\"200\"]]| \n")
21 + #set($block = "${block}|[[image:${resolvedImage}||data-xwiki-image-style=\"thumbnail-clickable\" style=\"border:1px solid #ccc\" width=\"200\"]]| \n")
25 25  #else
26 - #set($builder = "${builder}|No image provided.| \n")
23 + #set($block = "${block}|No image provided.| \n")
27 27  #end
25 +#set($block = "${block}\n=== [[$headline>>$url]] ===\n\n")
26 +#set($block = "${block}$desc\n[[Read More>>$url]]")
28 28  
29 -## Add title and body
30 -#set($builder = "${builder}\n=== [[$headline>>$url]] ===\n\n")
31 -#set($builder = "${builder}$desc\n[[Read More>>$url]]")
32 -
33 -## Save to current doc
28 +## Append to current document
34 34  #set($doc = $xwiki.getDocument($doc.fullName))
35 35  #set($content = $doc.getContent())
36 -$doc.setContent("${content}\n\n${builder}")
31 +$doc.setContent("${content}\n\n${block}")
37 37  $doc.save()
38 38  
39 39  <div class="xwiki-messages xwiki-successmessage">Incident added to this page.</div>