Revision fa125787
Von Sven Schöling vor fast 13 Jahren hinzugefügt
SL/Helper/Flash.pm | ||
---|---|---|
5 | 5 |
require Exporter; |
6 | 6 |
our @ISA = qw(Exporter); |
7 | 7 |
our @EXPORT = qw(flash flash_later); |
8 |
our @EXPORT_OK = qw(render_flash); |
|
8 |
our @EXPORT_OK = qw(render_flash delay_flash);
|
|
9 | 9 |
|
10 | 10 |
my %valid_categories = ( |
11 | 11 |
map({$_ => 'info'} qw(information message)), |
... | ... | |
24 | 24 |
$::auth->set_session_value({ key => "FLASH", value => _store_flash($::auth->get_session_value('FLASH'), @_), auto_restore => 1 }); |
25 | 25 |
} |
26 | 26 |
|
27 |
sub delay_flash { |
|
28 |
my $store = $::form->{FLASH} || { }; |
|
29 |
flash_later($_ => @{ $store->{$_} || [] }) for keys %$store; |
|
30 |
} |
|
31 |
|
|
27 | 32 |
sub render_flash { |
28 | 33 |
return $::form->parse_html_template('common/flash'); |
29 | 34 |
} |
... | ... | |
36 | 41 |
my $store = shift || { }; |
37 | 42 |
my $category = _check_category(+shift); |
38 | 43 |
|
39 |
$store ||= { }; |
|
40 | 44 |
$store->{ $category } ||= [ ]; |
41 | 45 |
push @{ $store->{ $category } }, @_; |
42 | 46 |
|
... | ... | |
109 | 113 |
|
110 | 114 |
This function is not exported by default. |
111 | 115 |
|
116 |
=item C<delay_flash> |
|
117 |
|
|
118 |
Delays flash, as if all flash messages in this request would have been |
|
119 |
C<flash_later> |
|
120 |
|
|
121 |
Not exported by default. |
|
122 |
|
|
112 | 123 |
=back |
113 | 124 |
|
114 | 125 |
=head1 AUTHOR |
Auch abrufbar als: Unified diff
delay_flash