Revision 1df575c4
Von Moritz Bunkus vor etwa 7 Jahren hinzugefügt
SL/Controller/BackgroundJob.pm | ||
---|---|---|
28 | 28 |
sub action_list { |
29 | 29 |
my ($self) = @_; |
30 | 30 |
|
31 |
$self->setup_list_action_bar; |
|
31 | 32 |
$self->render('background_job/list', |
32 | 33 |
title => $::locale->text('Background jobs'), |
33 | 34 |
BACKGROUND_JOBS => $self->models->get, |
... | ... | |
38 | 39 |
my ($self) = @_; |
39 | 40 |
|
40 | 41 |
$self->background_job(SL::DB::BackgroundJob->new(cron_spec => '* * * * *', package_name => 'Test')); |
42 |
$self->setup_form_action_bar; |
|
41 | 43 |
$self->render('background_job/form', |
42 | 44 |
title => $::locale->text('Create a new background job'), |
43 | 45 |
JOB_CLASSES => [ SL::BackgroundJob::Base->get_known_job_classes ]); |
... | ... | |
46 | 48 |
sub action_edit { |
47 | 49 |
my ($self) = @_; |
48 | 50 |
|
51 |
$self->setup_form_action_bar; |
|
49 | 52 |
$self->render('background_job/form', |
50 | 53 |
title => $::locale->text('Edit background job'), |
51 | 54 |
JOB_CLASSES => [ SL::BackgroundJob::Base->get_known_job_classes ]); |
... | ... | |
183 | 186 |
); |
184 | 187 |
} |
185 | 188 |
|
189 |
sub setup_list_action_bar { |
|
190 |
my ($self) = @_; |
|
191 |
|
|
192 |
for my $bar ($::request->layout->get('actionbar')) { |
|
193 |
$bar->add( |
|
194 |
link => [ |
|
195 |
t8('Add'), |
|
196 |
link => $self->url_for(action => 'new'), |
|
197 |
accesskey => 'enter', |
|
198 |
], |
|
199 |
link => [ |
|
200 |
t8('Server control'), |
|
201 |
link => $self->url_for(controller => 'TaskServer', action => 'show'), |
|
202 |
], |
|
203 |
link => [ |
|
204 |
t8('Job history'), |
|
205 |
link => $self->url_for(controller => 'BackgroundJobHistory', action => 'list'), |
|
206 |
], |
|
207 |
); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
sub setup_form_action_bar { |
|
212 |
my ($self) = @_; |
|
213 |
|
|
214 |
my $is_new = !$self->background_job->id; |
|
215 |
|
|
216 |
for my $bar ($::request->layout->get('actionbar')) { |
|
217 |
$bar->add( |
|
218 |
combobox => [ |
|
219 |
action => [ |
|
220 |
t8('Save'), |
|
221 |
submit => [ '#form', { action => 'BackgroundJob/' . ($is_new ? 'create' : 'update') } ], |
|
222 |
accesskey => 'enter', |
|
223 |
], |
|
224 |
action => [ |
|
225 |
t8('Save and execute'), |
|
226 |
submit => [ '#form', { action => 'BackgroundJob/save_and_execute' } ], |
|
227 |
], |
|
228 |
], # end of combobox "Save" |
|
229 |
|
|
230 |
action => [ |
|
231 |
t8('Delete'), |
|
232 |
submit => [ '#form', { action => 'BackgroundJob/delete' } ], |
|
233 |
confirm => t8('Do you really want to delete this object?'), |
|
234 |
disabled => $is_new ? t8('This object has not been saved yet.') : undef, |
|
235 |
], |
|
236 |
|
|
237 |
link => [ |
|
238 |
t8('Abort'), |
|
239 |
link => $self->url_for(action => 'list'), |
|
240 |
], |
|
241 |
|
|
242 |
link => [ |
|
243 |
t8('Job history'), |
|
244 |
link => $self->url_for(controller => 'BackgroundJobHistory', action => 'list', 'filter.package_name:substr::ilike' => $self->background_job->package_name), |
|
245 |
disabled => $is_new ? t8('This object has not been saved yet.') : undef, |
|
246 |
], |
|
247 |
); |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
186 | 251 |
1; |
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »Aktuelle Hintergrund-Jobs anzeigen«