0 Votes

Changes for page SubmitIncidentMacro

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

From version 3.3
edited by Ryan C
on 2025/06/08 04:04
Change comment: There is no comment for this version
To version 2.5
edited by Ryan C
on 2025/06/08 03:34
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,12 +1,41 @@
1 1  {{velocity}}
2 -#set($headline = $wikimacro.parameters.headline)
3 -#set($url = $wikimacro.parameters.url)
2 +#set($request = $request)
3 +#if($request.getParameter("submitIncident"))
4 + #set($headline = $request.getParameter("headline"))
5 + #set($url = $request.getParameter("url"))
6 + #set($desc = $request.getParameter("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>
8 +#set($block = '''
9 +(% style="margin-bottom:20px; width:100%" %)
10 +|[[image:PLACEHOLDER.jpg||alt="image" data-xwiki-image-style="thumbnail-clickable" style="border:1px solid #cccccc" width="200"]]|
11 11  
12 +=== [[${headline}>>${url}]] ===
13 +
14 +${desc}
15 +[[Read More>>${url}]]
16 +''')
17 +
18 +
19 + #set($doc = $xwiki.getDocument($doc.fullName))
20 + #set($content = $doc.getContent())
21 + $doc.setContent("${content}\n\n${block}")
22 + $doc.save()
23 +
24 + <div class=\"xwiki-messages xwiki-successmessage\">Incident added to page.</div>
25 +#end
26 +
27 +<form method="post">
28 + <h3>Add Incident</h3>
29 + <label>Headline:</label><br/>
30 + <input type="text" name="headline" style="width:100%" /><br/><br/>
31 +
32 + <label>URL:</label><br/>
33 + <input type="text" name="url" style="width:100%" /><br/><br/>
34 +
35 + <label>Description:</label><br/>
36 + <textarea name="description" rows="4" style="width:100%"></textarea><br/><br/>
37 +
38 + <input type="submit" name="submitIncident" value="Submit Incident" />
39 +</form>
12 12  {{/velocity}}
41 +
XWiki.WikiMacroParameterClass[1]
Parameter description
... ... @@ -1,1 +1,5 @@
1 +
2 +
1 1  The source URL of the incident (link)
4 +
5 +
XWiki.WikiMacroParameterClass[2]
Parameter type
... ... @@ -1,1 +1,1 @@
1 -org.xwiki.rendering.listener.reference.ResourceReference
1 +Wiki
XWiki.WikiMacroParameterClass[3]
Parameter description
... ... @@ -1,1 +1,0 @@
1 -Description of the incident
Parameter group
... ... @@ -1,1 +1,0 @@
1 -Main Info
Parameter mandatory
... ... @@ -1,1 +1,0 @@
1 -Yes
Parameter name
... ... @@ -1,1 +1,0 @@
1 -description
Parameter type
... ... @@ -1,1 +1,0 @@
1 -Wiki