From 5c184abc6228356bbceea79cb4e2e99a62c956f9 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 18 Jan 2008 12:52:02 +0000 Subject: [PATCH] =?utf8?q?API-Anpassung=20f=C3=BCr=20$form->show=5Fgeneric?= =?utf8?q?=5Ferror():=20Man=20kann=20einen=20JavaScript-"Zur=C3=BCck"-Butt?= =?utf8?q?on=20anzeigen=20lassen,=20oder=20einen=20Button=20mit=20beliebig?= =?utf8?q?em=20anderen=20Text.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 25 ++++++++------ templates/webpages/generic/error_de.html | 36 +++++++++++++++----- templates/webpages/generic/error_master.html | 36 +++++++++++++++----- 3 files changed, 70 insertions(+), 27 deletions(-) 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 %] -- 2.20.1