0 Votes

Changes for page PublicSubmission

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

From version 15.1
edited by Ryan C
on 2025/06/08 18:11
Change comment: There is no comment for this version
To version 11.1
edited by Ryan C
on 2025/06/08 18:06
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,38 +1,51 @@
1 -{{html clean="false"}}
2 -<h3>Submit an Incident</h3>
3 -<form method="post" action="/bin/save/Help/Applications/Anti%20White%20Incidents/WebHome">
4 - <input type="hidden" name="xredirect" value="/bin/view/Help/Applications/Anti%20White%20Incidents/WebHome">
5 - <input type="hidden" name="form_token" value="$services.csrf.token">
6 - <input type="hidden" name="className" value="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass">
7 - <input type="hidden" name="classId" value="0">
8 -
9 - <div class="form-group">
10 - <label>Headline</label>
11 - <input type="text" name="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass_0_headline" class="form-control" required>
1 +{{velocity output="yes"}}
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.
12 12   </div>
13 -
14 - <div class="form-group">
15 - <label>Description</label>
16 - <textarea name="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass_0_description" class="form-control" rows="4" required></textarea>
17 - </div>
18 -
19 - <div class="form-group">
20 - <label>Source URL</label>
21 - <input type="text" name="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass_0_url" class="form-control">
22 - <small class="form-text text-muted">Enter full URL including https://</small>
23 - </div>
24 -
25 - <div class="form-group">
26 - <label>Image URL</label>
27 - <input type="text" name="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass_0_image" class="form-control">
28 - <small class="form-text text-muted">Enter full URL to image including https://</small>
29 - </div>
30 -
31 - <div class="form-group">
32 - <label>Date</label>
33 - <input type="date" name="Help.Applications.Anti White Incidents.Code.AntiWhiteIncidentsClass_0_date" class="form-control">
34 - </div>
35 -
36 - <button type="submit" class="btn btn-primary">Submit Incident</button>
37 -</form>
38 -{{/html}}
17 +#else
18 + <h3>Submit an Incident</h3>
19 + <form method="post" action="$xwiki.getDocument($doc.fullName).getExternalURL()">
20 + <input type="hidden" name="form_token" value="$!services.csrf.getToken()" />
21 +
22 + <div class="form-group">
23 + <label>Headline</label>
24 + <input type="text" name="headline" class="form-control" required>
25 + </div>
26 +
27 + <div class="form-group">
28 + <label>Description</label>
29 + <textarea name="description" class="form-control" rows="4" required></textarea>
30 + </div>
31 +
32 + <div class="form-group">
33 + <label>Source URL</label>
34 + <input type="url" name="url" class="form-control">
35 + </div>
36 +
37 + <div class="form-group">
38 + <label>Image URL</label>
39 + <input type="url" name="image" class="form-control">
40 + </div>
41 +
42 + <div class="form-group">
43 + <label>Date</label>
44 + <input type="date" name="date" class="form-control">
45 + </div>
46 +
47 + <button type="submit" class="btn btn-primary">Submit Incident</button>
48 + </form>
49 +#end
50 +{{/velocity}}
51 +