From: Moritz Bunkus Date: Fri, 18 Jan 2008 12:52:02 +0000 (+0000) Subject: API-Anpassung für $form->show_generic_error(): Man kann einen JavaScript-"Zurück... X-Git-Tag: release-2.6.0beta1~335 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5c184abc6228356bbceea79cb4e2e99a62c956f9;p=kivitendo-erp.git API-Anpassung für $form->show_generic_error(): Man kann einen JavaScript-"Zurück"-Button anzeigen lassen, oder einen Button mit beliebigem anderen Text. --- diff --git a/SL/Form.pm b/SL/Form.pm index 4c630f119..db7372539 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -772,23 +772,26 @@ sub parse_html_template { } sub show_generic_error { - my ($self, $error, $title, $action) = @_; + my ($self, $error, %params) = @_; my $add_params = { - 'title_error' => $title, + 'title_error' => $params{title}, 'label_error' => $error, }; - my @vars; - if ($action) { - map({ delete($self->{$_}); } qw(action)); - map({ push(@vars, { "name" => $_, "value" => $self->{$_} }) - if (!ref($self->{$_})); } - keys(%{$self})); - $add_params->{"SHOW_BUTTON"} = 1; - $add_params->{"BUTTON_LABEL"} = $action; + if ($params{action}) { + my @vars; + + map { delete($self->{$_}); } qw(action); + map { push @vars, { "name" => $_, "value" => $self->{$_} } if (!ref($self->{$_})); } keys %{ $self }; + + $add_params->{SHOW_BUTTON} = 1; + $add_params->{BUTTON_LABEL} = $params{label} || $params{action}; + $add_params->{VARIABLES} = \@vars; + + } elsif ($params{back_button}) { + $add_params->{SHOW_BACK_BUTTON} = 1; } - $add_params->{"VARIABLES"} = \@vars; $self->{title} = $title if ($title); diff --git a/templates/webpages/generic/error_de.html b/templates/webpages/generic/error_de.html index 9a029609e..f95bb3a13 100644 --- a/templates/webpages/generic/error_de.html +++ b/templates/webpages/generic/error_de.html @@ -1,12 +1,32 @@ [% USE HTML %] - - - - - - - -
[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]
[% label_error %]
+ +
[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]
+ +

[% label_error %]

+ + [%- IF SHOW_BACK_BUTTON %] +
+

+ +

+
+ + [%- ELSIF SHOW_BUTTON %] + +
+ + [%- FOREACH var = VARIABLES %] + + [%- END %] + + + +

+ +

+
+ + [%- END %] diff --git a/templates/webpages/generic/error_master.html b/templates/webpages/generic/error_master.html index 97e4da4ea..5ca71e28b 100644 --- a/templates/webpages/generic/error_master.html +++ b/templates/webpages/generic/error_master.html @@ -1,12 +1,32 @@ [% USE HTML %] - - - - - - - -
[% IF title_error %][% title_error %][% ELSE %]Error![% END %]
[% label_error %]
+ +
[% IF title_error %][% title_error %][% ELSE %]Error![% END %]
+ +

[% label_error %]

+ + [%- IF SHOW_BACK_BUTTON %] +
+

+ +

+
+ + [%- ELSIF SHOW_BUTTON %] + +
+ + [%- FOREACH var = VARIABLES %] + + [%- END %] + + + +

+ +

+
+ + [%- END %]