Revision 95c80e5e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
bin/mozilla/amtemplates.pl | ||
---|---|---|
37 | 37 |
use SL::DB::Default; |
38 | 38 |
use SL::AM; |
39 | 39 |
use SL::Form; |
40 |
use SL::Locale::String qw(t8); |
|
40 | 41 |
|
41 | 42 |
use Data::Dumper; |
42 | 43 |
|
... | ... | |
278 | 279 |
$options{"CAN_EDIT"} = $form->{"edit"}; |
279 | 280 |
|
280 | 281 |
if (!$form->{edit}) { |
281 |
$options{"content"} = "\n\n" if (!$options{"content"}); |
|
282 |
$options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25; |
|
282 |
$options{"content"} = "\n\n" if (!$options{"content"}); |
|
283 | 283 |
} |
284 | 284 |
} |
285 | 285 |
|
286 | 286 |
$options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ]; |
287 | 287 |
|
288 |
setup_amtemplates_display_form_action_bar( |
|
289 |
mode => $form->{edit} ? 'edit' : 'show', |
|
290 |
template_selected => $options{SHOW_CONTENT}, |
|
291 |
); |
|
292 |
|
|
288 | 293 |
$form->header; |
289 | 294 |
print($form->parse_html_template("am/edit_templates", \%options)); |
290 | 295 |
|
291 | 296 |
$main::lxdebug->leave_sub(); |
292 | 297 |
} |
293 | 298 |
|
299 |
sub setup_amtemplates_display_form_action_bar { |
|
300 |
my %params = @_; |
|
301 |
|
|
302 |
for my $bar ($::request->layout->get('actionbar')) { |
|
303 |
$bar->add( |
|
304 |
action => [ |
|
305 |
t8('Edit'), |
|
306 |
submit => [ '#form', { action => 'edit_template' } ], |
|
307 |
accesskey => 'enter', |
|
308 |
only_if => $params{mode} eq 'show', |
|
309 |
disabled => !$params{template_selected} ? t8('No template has been selected yet.') : undef, |
|
310 |
], |
|
311 |
|
|
312 |
action => [ |
|
313 |
t8('Save'), |
|
314 |
submit => [ '#form', { action => 'save_template' } ], |
|
315 |
accesskey => 'enter', |
|
316 |
only_if => $params{mode} eq 'edit', |
|
317 |
], |
|
318 |
|
|
319 |
action => [ |
|
320 |
t8('Abort'), |
|
321 |
call => [ 'kivi.history_back' ], |
|
322 |
only_if => $params{mode} eq 'edit', |
|
323 |
], |
|
324 |
); |
|
325 |
} |
|
326 |
} |
|
327 |
|
|
294 | 328 |
1; |
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »System« → »Vorlagen« → *