0 Votes

Changes for page PublicSubmission

Last modified by Ryan C on 2025/06/08 18:17

From version 5.1
edited by Ryan C
on 2025/06/08 17:58
Change comment: There is no comment for this version
To version 6.1
edited by Ryan C
on 2025/06/08 17:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,49 @@
1 1  {{velocity}}
2 -Hello from a test Velocity macro! Time: $datetool.format('yyyy-MM-dd HH:mm:ss', $datetool.now())
2 +#if($request.headline)
3 + ## Processing form submission
4 + #set($appPage = $xwiki.getDocument("Help.Applications.AntiWhiteIncidents.WebHome"))
5 + #set($className = "Help.Applications.AntiWhiteIncidents.Code.AntiWhiteIncidentsClass")
6 + #set($obj = $appPage.newObject($className))
7 + $obj.set("headline", $request.headline)
8 + $obj.set("description", $request.description)
9 + $obj.set("url", $request.url)
10 + $obj.set("image", $request.image)
11 + $obj.set("date", $request.date)
12 + $appPage.save("Added new incident from public form")
13 +
14 + <div class="alert alert-success">
15 + Thank you for your submission. It has been added to our database.
16 + </div>
17 +#else
18 + <h3>Submit an Incident</h3>
19 + <form method="post" action="$doc.getURL()">
20 + <div class="form-group">
21 + <label>Headline</label>
22 + <input type="text" name="headline" class="form-control" required>
23 + </div>
24 +
25 + <div class="form-group">
26 + <label>Description</label>
27 + <textarea name="description" class="form-control" rows="4" required></textarea>
28 + </div>
29 +
30 + <div class="form-group">
31 + <label>Source URL</label>
32 + <input type="url" name="url" class="form-control">
33 + </div>
34 +
35 + <div class="form-group">
36 + <label>Image URL</label>
37 + <input type="url" name="image" class="form-control">
38 + </div>
39 +
40 + <div class="form-group">
41 + <label>Date</label>
42 + <input type="date" name="date" class="form-control">
43 + </div>
44 +
45 + <button type="submit" class="btn btn-primary">Submit Incident</button>
46 + </form>
47 +#end
3 3  {{/velocity}}
4 4