0 Votes

Changes for page SubmitIncidentMacro

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

From version 1.1
edited by Ryan C
on 2025/06/08 03:01
Change comment: There is no comment for this version
To version 3.21
edited by Ryan C
on 2025/06/08 04:51
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,40 +1,44 @@
1 1  {{velocity}}
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"))
2 +#set($headline = "$!wikimacro.parameters.headline")
3 +#set($url = "$!wikimacro.parameters.url")
4 +#set($description = "$!wikimacro.parameters.description")
5 +#set($image = "$!wikimacro.parameters.image")
7 7  
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\"]]|
7 +## Escape for copy box — so it's literal and doesn't render
8 +#set($copyText = """
9 +(% style="margin-bottom:20px; width:100%" %)
10 +|#if($image != "")[[image:$image||data-xwiki-image-style="thumbnail-clickable" style="border:1px solid #ccc" width="200"]]#{else}No image provided.#{end}|
11 +=== [[$headline>>$url]] ===
12 +$description
13 +[[Read More>>$url]]
14 +""")
11 11  
12 -=== [[${headline}>>${url}]] ===
16 +## Left side: Copyable syntax
17 +{{box title="Wiki Syntax (Copy and paste this)" cssClass="infobox" style="width:48%; float:left; margin-right:2%;"}}
18 +{{code language="xwiki/2.1"}}
19 +$copyText
20 +{{/code}}
21 +{{/box}}
13 13  
14 -${desc}
15 -[[Read More>>${url}]]
16 -")
17 -
18 - #set($doc = $xwiki.getDocument($doc.fullName))
19 - #set($content = $doc.getContent())
20 - $doc.setContent("${content}\n\n${block}")
21 - $doc.save()
22 -
23 - <div class=\"xwiki-messages xwiki-successmessage\">Incident added to page.</div>
23 +## Right side: Preview
24 +{{box title="Preview" cssClass="floatinginfobox" style="width:48%; float:left;"}}
25 +#if($image && $image != "")
26 + [[image:$image||width="200" style="border:1px solid #ccc;"]]
27 +#else
28 + (% style="width:200px; height:150px; background:#eee; text-align:center; border:1px solid #ccc;" %)
29 + No image
30 + (%)
24 24  #end
25 25  
26 -<form method="post">
27 - <h3>Add Incident</h3>
28 - <label>Headline:</label><br/>
29 - <input type="text" name="headline" style="width:100%" /><br/><br/>
33 +=== [[$headline>>$url]] ===
30 30  
31 - <label>URL:</label><br/>
32 - <input type="text" name="url" style="width:100%" /><br/><br/>
35 +$description
33 33  
34 - <label>Description:</label><br/>
35 - <textarea name="description" rows="4" style="width:100%"></textarea><br/><br/>
37 +[[Read More>>$url]]
38 +{{/box}}
36 36  
37 - <input type="submit" name="submitIncident" value="Submit Incident" />
38 -</form>
40 +## Clear the floats
41 +(% style="clear:both;" %)
42 +(%)
39 39  {{/velocity}}
40 40  
Macro content type
... ... @@ -1,0 +1,1 @@
1 +Unknown
Macro content availability
... ... @@ -1,0 +1,1 @@
1 +No content
Macro visibility
... ... @@ -1,0 +1,1 @@
1 +Current Wiki
XWiki.WikiMacroParameterClass[0]
Parameter deprecated
... ... @@ -1,0 +1,1 @@
1 +No
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The title of the incident
Parameter group
... ... @@ -1,0 +1,1 @@
1 +Main Info
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +Yes
Parameter name
... ... @@ -1,0 +1,1 @@
1 +headline
Parameter type
... ... @@ -1,0 +1,1 @@
1 +Unknown
XWiki.WikiMacroParameterClass[1]
Parameter deprecated
... ... @@ -1,0 +1,1 @@
1 +No
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The source URL of the incident (link)
Parameter group
... ... @@ -1,0 +1,1 @@
1 +Main Info
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +Yes
Parameter name
... ... @@ -1,0 +1,1 @@
1 +URL
Parameter type
... ... @@ -1,0 +1,1 @@
1 +Unknown
XWiki.WikiMacroParameterClass[3]
Parameter deprecated
... ... @@ -1,0 +1,1 @@
1 +No
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Description of the incident
Parameter group
... ... @@ -1,0 +1,1 @@
1 +Main Info
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +Yes
Parameter name
... ... @@ -1,0 +1,1 @@
1 +description
Parameter type
... ... @@ -1,0 +1,1 @@
1 +Wiki
XWiki.WikiMacroParameterClass[4]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Upload or select an image to display with the incident (e.g. myimage.jpg)
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +image
Parameter type
... ... @@ -1,0 +1,1 @@
1 +Unknown