Changes for page Job Scheduler

Last modified by Mark Kohlmann on 2024/07/26 08:06

From version 2.1
edited by Mark Kohlmann
on 2020/04/03 03:54
Change comment: Install extension [org.xwiki.platform:xwiki-platform-scheduler-ui/12.2]
To version 3.1
edited by Mark Kohlmann
on 2024/07/26 08:06
Change comment: Install extension [org.xwiki.platform:xwiki-platform-scheduler-ui/16.5.0]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.MarkKohlmann
1 +XWiki.mark\.kohlmann@chiefintegrations\.com
Content
... ... @@ -13,7 +13,13 @@
13 13   #set ($tJobHolder = $request.which)
14 14   #set ($jobDoc = $xwiki.getDocument($tJobHolder))
15 15   #set ($jobObj = $jobDoc.getObject('XWiki.SchedulerJobClass'))
16 - #if ($request.do == 'schedule')
16 + #if (!$services.csrf.isTokenValid($request.form_token))
17 + ##
18 + ## Check that the CSRF token matches the user before any operation
19 + ##
20 + {{error}}$services.localization.render('xe.scheduler.invalidToken'){{/error}}
21 +
22 + #elseif ($request.do == 'schedule')
17 17   ##
18 18   ## Schedule a job
19 19   ##
... ... @@ -105,7 +105,6 @@
105 105  ##
106 106  |=(%scope="col"%)$services.localization.render('xe.scheduler.jobs.name')|=(%scope="col"%)$services.localization.render('xe.scheduler.jobs.status')|=(%scope="col"%)$services.localization.render('xe.scheduler.jobs.next')|=(%scope="col"%)$services.localization.render('xe.scheduler.jobs.actions')
107 107  #foreach ($docName in $services.query.xwql('from doc.object(XWiki.SchedulerJobClass) as jobs where doc.fullName <> ''XWiki.SchedulerJobTemplate''').execute())
108 - #set ($actions = {})
109 109   #set ($jobHolder = $xwiki.getDocument($docName))
110 110   #set ($job = $jobHolder.getObject('XWiki.SchedulerJobClass'))
111 111   #set ($status = $scheduler.getJobStatus($job).value)
... ... @@ -118,18 +118,16 @@
118 118   #else
119 119   #set ($firetime = $services.localization.render('xe.scheduler.jobs.next.undefined'))
120 120   #end
121 - #set ($ok = $!actions.put('trigger', $doc.getURL('view', "do=trigger&which=${jobHolder.fullName}")))
126 + #set ($actions = ['trigger'])
122 122   #if ($status == 'None')
123 - #set ($ok = $!actions.put('schedule', $doc.getURL('view', "do=schedule&which=${jobHolder.fullName}")))
128 + #set ($ok = $actions.add('schedule'))
124 124   #elseif($status == 'Normal')
125 - #set ($ok = $!actions.put('pause', $doc.getURL('view', "do=pause&which=${jobHolder.fullName}")))
126 - #set ($ok = $!actions.put('unschedule', $doc.getURL('view', "do=unschedule&which=${jobHolder.fullName}")))
130 + #set ($ok = $actions.addAll(['pause', 'unschedule']))
127 127   #elseif ($status == 'Paused')
128 - #set ($ok = $!actions.put('resume', $doc.getURL('view', "do=resume&which=${jobHolder.fullName}")))
129 - #set ($ok = $!actions.put('unschedule', $doc.getURL('view', "do=unschedule&which=${jobHolder.fullName}")))
132 + #set ($ok = $actions.addAll(['resume', 'unschedule']))
130 130   #end
131 - #set ($ok = $!actions.put('delete', $doc.getURL('view', "do=delete&which=${jobHolder.fullName}")))
132 -|$job.get('jobName')|$status|$firetime|**$services.localization.render('xe.scheduler.jobs.actions.access')** [[$services.localization.render('xe.scheduler.jobs.actions.view')>>$jobHolder.fullName]]#if($jobHolder.hasAccessLevel('programming')) [[$services.localization.render('xe.scheduler.jobs.actions.edit')>>path:${jobHolder.getURL('edit')}]]#end **$services.localization.render('xe.scheduler.jobs.actions.manage')**#foreach($action in $actions.entrySet()) [[$services.localization.render("xe.scheduler.jobs.actions.${action.key}")>>path:${action.value}]]#end
134 + #set ($ok = $actions.add('delete'))
135 +|$job.get('jobName')|$status|$firetime|**$services.localization.render('xe.scheduler.jobs.actions.access')** [[$services.localization.render('xe.scheduler.jobs.actions.view')>>$services.rendering.escape($jobHolder.fullName, 'xwiki/2.1')]]#if($jobHolder.hasAccessLevel('programming')) [[$services.localization.render('xe.scheduler.jobs.actions.edit')>>path:${jobHolder.getURL('edit')}]]#end **$services.localization.render('xe.scheduler.jobs.actions.manage')**#foreach($action in $actions) [[$services.localization.render("xe.scheduler.jobs.actions.$action")>>path:$doc.getURL('view', $escapetool.url({'do': $action, 'which': $jobHolder.fullName, 'form_token': $services.csrf.token}))]]#end
133 133  
134 134  #end
135 135  #if ($doc.hasAccessLevel('programming'))
... ... @@ -154,9 +154,9 @@
154 154   <input type="hidden" name="template" value="XWiki.SchedulerJobTemplate" />
155 155   <input type="hidden" name="sheet" value="1" />
156 156   <input type="hidden" name="space" value="Scheduler"/>
157 - <label class="hidden" for="page">$services.localization.render('xe.scheduler.jobs.create.nameTip')</label>
160 + <label class="sr-only" for="page">$services.localization.render('xe.scheduler.jobs.create.nameTip')</label>
158 158   <input id="page" name="page" size="30" type="text"
159 - value="$escapetool.xml($services.localization.render('xe.scheduler.jobs.create.nameTip'))" />
162 + placeholder="$escapetool.xml($services.localization.render('xe.scheduler.jobs.create.nameTip'))" />
160 160   <span class="buttonwrapper">
161 161   <input type="submit" class="btn btn-success"
162 162   value="$escapetool.xml($services.localization.render('xe.scheduler.jobs.create.submit'))"/>