Wiki source code of My ISMS Tasks

Last modified by Lee Pedley on 2026/09/23 10:20

Show last authors
1 {{velocity}}
2 #set($me=$xcontext.user)
3 #set($tasks=[])
4 #set($window=30)
5 #set($settingsDoc=$xwiki.getDocument('ISMS.Settings'))
6 #set($settings=$settingsDoc.getObject('ISMS.Code.SettingsClass'))
7 #if($settings && $settings.getProperty('documentHorizonDays').getValue())#set($window=$settings.getProperty('documentHorizonDays').getValue())#end
8 #macro(addTask $type $ref $owner $status $due $closed)
9 #if($owner && $owner==$me && !$closed)
10 #set($when='No due date')#set($urgency='Open')
11 #if($due)#set($days=$datetool.whenIs($due).days)#set($when=$xwiki.formatDate($due))#if($days<0)#set($urgency='Overdue')#elseif($days<=$window)#set($urgency='Due soon')#else#set($urgency='Open')#end#end
12 #set($d=$xwiki.getDocument($ref))#set($x=$tasks.add([$urgency,$type,$ref,$d.displayTitle,$status,$when]))
13 #end
14 #end
15 #set($docs=$services.query.xwql("from doc.object('Risks.Code.RisksClass') as obj").setLimit(2000).execute())
16 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Risks.Code.RisksClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('targetDate').getValue())#set($closed=$st=='Closed')#addTask('Risk' $ref $owner $st $due $closed)#end#end
17 #set($docs=$services.query.xwql("from doc.object('Risk Treatments.Code.Risk TreatmentsClass') as obj").setLimit(2000).execute())
18 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Risk Treatments.Code.Risk TreatmentsClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('targetDate').getValue())#set($closed=$st=='Complete'||$st=='Cancelled')#addTask('Risk treatment' $ref $owner $st $due $closed)#end#end
19 #set($docs=$services.query.xwql("from doc.object('Controls and SoA.Code.Controls and SoAClass') as obj").setLimit(2000).execute())
20 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Controls and SoA.Code.Controls and SoAClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('implementationStatus').getValue())#set($due=$o.getProperty('nextReviewDate').getValue())#addTask('Control review' $ref $owner $st $due false)#end#end
21 #set($docs=$services.query.xwql("from doc.object('Evidence.Code.EvidenceClass') as obj").setLimit(2000).execute())
22 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Evidence.Code.EvidenceClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('validUntil').getValue())#set($closed=$st=='Superseded')#addTask('Evidence review' $ref $owner $st $due $closed)#end#end
23 #set($docs=$services.query.xwql("from doc.object('Controlled Documents.Code.Controlled DocumentsClass') as obj").setLimit(2000).execute())
24 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Controlled Documents.Code.Controlled DocumentsClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('nextReviewDate').getValue())#set($closed=$st=='Archived'||$st=='Superseded')#addTask('Document review' $ref $owner $st $due $closed)#end#end
25 #set($docs=$services.query.xwql("from doc.object('Audits.Code.AuditsClass') as obj").setLimit(2000).execute())
26 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Audits.Code.AuditsClass'))#if($o)#set($owner=$o.getProperty('leadAuditor').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('endDate').getValue())#set($closed=$st=='Complete'||$st=='Cancelled')#addTask('Audit' $ref $owner $st $due $closed)#end#end
27 #set($docs=$services.query.xwql("from doc.object('Findings.Code.FindingsClass') as obj").setLimit(2000).execute())
28 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Findings.Code.FindingsClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('dueDate').getValue())#set($closed=$st=='Closed')#addTask('Finding' $ref $owner $st $due $closed)#end#end
29 #set($docs=$services.query.xwql("from doc.object('Corrective Actions.Code.Corrective ActionsClass') as obj").setLimit(2000).execute())
30 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Corrective Actions.Code.Corrective ActionsClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('dueDate').getValue())#set($closed=$st=='Verified'||$st=='Cancelled')#addTask('Corrective action' $ref $owner $st $due $closed)#end#end
31 #set($docs=$services.query.xwql("from doc.object('Access Reviews.Code.Access ReviewsClass') as obj").setLimit(2000).execute())
32 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Access Reviews.Code.Access ReviewsClass'))#if($o)#set($owner=$o.getProperty('reviewer').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('scheduledDate').getValue())#set($closed=$st=='Complete'||$st=='Cancelled')#addTask('Access review' $ref $owner $st $due $closed)#end#end
33 #set($docs=$services.query.xwql("from doc.object('Evidence Sources.Code.Evidence SourcesClass') as obj").setLimit(2000).execute())
34 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Evidence Sources.Code.Evidence SourcesClass'))#if($o)#set($owner=$o.getProperty('owner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('nextCollectionDate').getValue())#set($closed=$st=='Disabled'||$st=='Not Configured')#addTask('Evidence source' $ref $owner $st $due $closed)#end#end
35 #set($docs=$services.query.xwql("from doc.object('Suppliers and Third Parties.Code.Suppliers and Third PartiesClass') as obj").setLimit(3000).execute())
36 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Suppliers and Third Parties.Code.Suppliers and Third PartiesClass'))#if($o)#set($owner=$o.getProperty('businessOwner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('nextReviewDate').getValue())#set($closed=$st=='Terminated')#addTask('Supplier review' $ref $owner $st $due $closed)#end#end
37 #set($docs=$services.query.xwql("from doc.object('Supplier Contracts.Code.Supplier ContractsClass') as obj").setLimit(5000).execute())
38 #foreach($ref in $docs)#set($d=$xwiki.getDocument($ref))#set($o=$d.getObject('Supplier Contracts.Code.Supplier ContractsClass'))#if($o)#set($owner=$o.getProperty('contractOwner').getValue())#set($st=$o.getProperty('status').getValue())#set($due=$o.getProperty('nextReviewDate').getValue())#if(!$due)#set($due=$o.getProperty('expiryDate').getValue())#end#set($closed=$st=='Terminated'||$st=='Superseded'||$st=='Expired')#addTask('Supplier contract' $ref $owner $st $due $closed)#end#end
39 {{html wiki="true" clean="false"}}
40 <style>.task-table{width:100%;border-collapse:collapse}.task-table th,.task-table td{padding:8px;border-bottom:1px solid #dfe4e8;text-align:left;vertical-align:top}.task-overdue{font-weight:700}.task-actions{display:flex;gap:7px;flex-wrap:wrap;margin:12px 0 18px}</style>
41 <div class="box infomessage"><strong>My ISMS Tasks</strong><br/>Open records owned by <strong>$escapetool.xml($me)</strong>. Due-soon means within $window days. Ownership comes from each register's owner/reviewer field.</div>
42 <div class="task-actions"><a class="btn btn-primary" href="$xwiki.getURL('ISMS.Dashboard','view')">Management Dashboard</a><a class="btn btn-default" href="$xwiki.getURL('ISMS.AutomationHub','view')">Automation Hub</a></div>
43 #if($tasks.isEmpty())<div class="box successmessage">No open ISMS records are currently assigned to you.</div>#else
44 <table class="task-table"><thead><tr><th>Priority</th><th>Type</th><th>Record</th><th>Status</th><th>Due / review</th></tr></thead><tbody>#foreach($t in $tasks)<tr#if($t.get(0)=='Overdue') class="task-overdue"#end><td>$escapetool.xml($t.get(0))</td><td>$escapetool.xml($t.get(1))</td><td><a href="$xwiki.getURL($t.get(2),'view')">$escapetool.xml($t.get(3))</a></td><td>$escapetool.xml($t.get(4))</td><td>$escapetool.xml($t.get(5))</td></tr>#end</tbody></table>#end
45 {{/html}}
46 {{/velocity}}