0 Votes

Changes for page Incidents list

Last modified by Ryan C on 2025/07/14 15:42

From version 1.1
edited by Ryan C
on 2025/07/14 13:46
Change comment: There is no comment for this version
To version 2.1
edited by Ryan C
on 2025/07/14 14:00
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,0 +1,33 @@
1 +{{groovy}}
2 +def results = xwiki.search("""
3 + select doc.fullName, doc.title
4 + from XWikiDocument doc, BaseObject obj
5 + where obj.className = 'Main Categories.Anti White Incidents.Code.MoviesClass'
6 + and obj.name = doc.fullName
7 + and doc.hidden = false
8 + order by doc.creationDate desc
9 +""")
10 +
11 +results.each { row ->
12 + def docName = row[0]
13 + def fallbackTitle = row[1]
14 + try {
15 + def doc = xwiki.getDocument(docName)
16 + def obj = doc.getObject('Main Categories.Anti White Incidents.Code.MoviesClass')
17 + if (obj) {
18 + def rawHeadline = obj.getProperty('headline')?.value
19 + def headline = (rawHeadline instanceof String) ? rawHeadline.trim() : null
20 + if (headline && headline.length() > 0) {
21 + println "* [[${headline}>>doc:${docName}]]"
22 + } else if (fallbackTitle && fallbackTitle.trim().length() > 0) {
23 + println "* [[${fallbackTitle.trim()}>>doc:${docName}]]"
24 + } else {
25 + println "* [[${docName}>>doc:${docName}]]"
26 + }
27 + }
28 + } catch (Exception e) {
29 + println "## Error reading: ${docName} -- ${e.message}"
30 + }
31 +}
32 +{{/groovy}}
33 +

XWiki AI Chat