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.20
edited by Ryan C
on 2025/06/08 04:48
Change comment: There is no comment for this version

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,40 +1,43 @@
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 +## Left side: Copyable syntax
8 +{{box title="Wiki Syntax (Copy and paste this)" cssClass="infobox" style="width:48%; float:left; margin-right:2%;"}}
9 +(% style="margin-bottom:20px; width:100%" %)
10 +| #if($image != "")
11 + [[image:$image||data-xwiki-image-style="thumbnail-clickable" style="border:1px solid #ccc" width="200"]]
12 + #else
13 + No image provided.
14 + #end |
15 +=== [[$headline>>$url]] ===
11 11  
12 -=== [[${headline}>>${url}]] ===
17 +$description
13 13  
14 -${desc}
15 -[[Read More>>${url}]]
16 -")
19 +[[Read More>>$url]]
20 +{{/box}}
17 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>
22 +## Right side: Preview
23 +{{box title="Preview" cssClass="floatinginfobox" style="width:48%; float:left;"}}
24 +#if($image && $image != "")
25 + [[image:$image||width="200" style="border:1px solid #ccc;"]]
26 +#else
27 + (% style="width:200px; height:150px; background:#eee; text-align:center; border:1px solid #ccc;" %)
28 + No image
29 + (%)
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/>
32 +=== [[$headline>>$url]] ===
30 30  
31 - <label>URL:</label><br/>
32 - <input type="text" name="url" style="width:100%" /><br/><br/>
34 +$description
33 33  
34 - <label>Description:</label><br/>
35 - <textarea name="description" rows="4" style="width:100%"></textarea><br/><br/>
36 +[[Read More>>$url]]
37 +{{/box}}
36 36  
37 - <input type="submit" name="submitIncident" value="Submit Incident" />
38 -</form>
39 +## Clear the floats
40 +(% style="clear:both;" %)
41 +(%)
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