Revision 5c184abc
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
772 | 772 |
} |
773 | 773 |
|
774 | 774 |
sub show_generic_error { |
775 |
my ($self, $error, $title, $action) = @_;
|
|
775 |
my ($self, $error, %params) = @_;
|
|
776 | 776 |
|
777 | 777 |
my $add_params = { |
778 |
'title_error' => $title,
|
|
778 |
'title_error' => $params{title},
|
|
779 | 779 |
'label_error' => $error, |
780 | 780 |
}; |
781 | 781 |
|
782 |
my @vars; |
|
783 |
if ($action) { |
|
784 |
map({ delete($self->{$_}); } qw(action)); |
|
785 |
map({ push(@vars, { "name" => $_, "value" => $self->{$_} }) |
|
786 |
if (!ref($self->{$_})); } |
|
787 |
keys(%{$self})); |
|
788 |
$add_params->{"SHOW_BUTTON"} = 1; |
|
789 |
$add_params->{"BUTTON_LABEL"} = $action; |
|
782 |
if ($params{action}) { |
|
783 |
my @vars; |
|
784 |
|
|
785 |
map { delete($self->{$_}); } qw(action); |
|
786 |
map { push @vars, { "name" => $_, "value" => $self->{$_} } if (!ref($self->{$_})); } keys %{ $self }; |
|
787 |
|
|
788 |
$add_params->{SHOW_BUTTON} = 1; |
|
789 |
$add_params->{BUTTON_LABEL} = $params{label} || $params{action}; |
|
790 |
$add_params->{VARIABLES} = \@vars; |
|
791 |
|
|
792 |
} elsif ($params{back_button}) { |
|
793 |
$add_params->{SHOW_BACK_BUTTON} = 1; |
|
790 | 794 |
} |
791 |
$add_params->{"VARIABLES"} = \@vars; |
|
792 | 795 |
|
793 | 796 |
$self->{title} = $title if ($title); |
794 | 797 |
|
Auch abrufbar als: Unified diff
API-Anpassung für $form->show_generic_error(): Man kann einen JavaScript-"Zurück"-Button anzeigen lassen, oder einen Button mit beliebigem anderen Text.