Changes for page Job Scheduler
Last modified by Mark Kohlmann on 2024/07/26 08:06
From version 1.1
edited by Mark Kohlmann
on 2020/04/02 23:25
on 2020/04/02 23:25
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-scheduler-ui-9.4]
To version 3.1
edited by Mark Kohlmann
on 2024/07/26 08:06
on 2024/07/26 08:06
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-scheduler-ui/16.5.0]
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. MarkKohlmann1 +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}]]#end134 + #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')) ... ... @@ -148,21 +148,25 @@ 148 148 {{info}}$services.localization.render('xe.scheduler.jobs.explaincreate'){{/info}} 149 149 150 150 {{html}} 151 -<form action="$doc.getURL('create')" id="newdoc"><div> 154 +<form action="$doc.getURL('create')" id="newdoc" class="form-inline"><div> 152 152 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> 153 153 <input type="hidden" name="parent" value="Scheduler.WebHome" /> 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> 158 - <input id="page" name="page" size="30" type="text" class="withTip" value="$services.localization.render('xe.scheduler.jobs.create.nameTip')" /> 159 - <span class="buttonwrapper"><input type="submit" class="btn btn-success button" value="$services.localization.render('xe.scheduler.jobs.create.submit')"/></span> 160 + <label class="sr-only" for="page">$services.localization.render('xe.scheduler.jobs.create.nameTip')</label> 161 + <input id="page" name="page" size="30" type="text" 162 + placeholder="$escapetool.xml($services.localization.render('xe.scheduler.jobs.create.nameTip'))" /> 163 + <span class="buttonwrapper"> 164 + <input type="submit" class="btn btn-success" 165 + value="$escapetool.xml($services.localization.render('xe.scheduler.jobs.create.submit'))"/> 166 + </span> 160 160 </div></form> 161 161 {{/html}} 162 162 163 163 #else 164 164 165 - {{warning}}$services.localization.render('xe.scheduler.jobs.warning') ){{/warning}}172 + {{warning}}$services.localization.render('xe.scheduler.jobs.warning'){{/warning}} 166 166 167 167 #end 168 168 {{/velocity}}