0 Votes

Changes for page SubmitIncidentMacro

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

From version 3.4
edited by Ryan C
on 2025/06/08 04:09
Change comment: There is no comment for this version
To version 3.7
edited by Ryan C
on 2025/06/08 04:12
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Context elements
... ... @@ -1,1 +1,1 @@
1 -Action, Document, Request parameters, Request wiki
1 +Document
Macro code
... ... @@ -1,12 +1,18 @@
1 1  {{velocity}}
2 2  #set($headline = $wikimacro.parameters.headline)
3 3  #set($url = $wikimacro.parameters.url)
4 +#set($description = $wikimacro.parameters.description)
4 4  
5 -## Simple test output
6 -<div class="incident-entry">
7 - <h3><a href="$url">$headline</a></h3>
8 - <p>URL: $url</p>
9 - <p>This is a test.</p>
10 -</div>
6 +## Build the incident block in XWiki syntax
7 +#set($block = "(% class=\"incident-entry\" %)\n")
8 +#set($block = "${block}=== [[$headline>>$url]] ===\n\n")
9 +#set($block = "${block}$description\n\n[[Read More>>$url]]")
11 11  
11 +## Append to current document
12 +#set($doc = $xwiki.getDocument($doc.fullName))
13 +#set($content = $doc.getContent())
14 +$doc.setContent("${content}\n\n${block}")
15 +$doc.save()
16 +
17 +<div class="alert alert-success">Incident added successfully.</div>
12 12  {{/velocity}}
XWiki.WikiMacroParameterClass[2]
Parameter advanced
... ... @@ -1,1 +1,0 @@
1 -No
Parameter deprecated
... ... @@ -1,1 +1,0 @@
1 -No
Parameter description
... ... @@ -1,1 +1,0 @@
1 -The name of the image attached to this page (e.g. myimage.jpg)
Parameter feature mandatory.
... ... @@ -1,1 +1,0 @@
1 -No
Parameter group
... ... @@ -1,1 +1,0 @@
1 -Media
Parameter hidden
... ... @@ -1,1 +1,0 @@
1 -No
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -No
Parameter name
... ... @@ -1,1 +1,0 @@
1 -Image
Parameter type
... ... @@ -1,1 +1,0 @@
1 -org.xwiki.rendering.listener.reference.ResourceReference