}
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);
[% USE HTML %]<body>
- <table width="100%">
- <tr>
- <th class="listtop">[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]</th>
- </tr>
- <tr height="5"></tr>
-
- <tr><td>[% label_error %]</td></tr>
- </table>
+
+ <div class="listtop">[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]</div>
+
+ <p>[% label_error %]</p>
+
+ [%- IF SHOW_BACK_BUTTON %]
+ <form>
+ <p>
+ <input type="button" onclick="history.back()" value="Zurück">
+ </p>
+ </form>
+
+ [%- ELSIF SHOW_BUTTON %]
+
+ <form action="[% HTML.escape(script) %]" method="post">
+
+ [%- FOREACH var = VARIABLES %]
+ <input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
+ [%- END %]
+
+ <input type="hidden" name="action" value="[% HTML.escape(action) %]">
+
+ <p>
+ <input type="submit" value="[% BUTTON_LABEL %]">
+ </p>
+ </form>
+
+ [%- END %]
</body>
</html>
[% USE HTML %]<body>
- <table width="100%">
- <tr>
- <th class="listtop">[% IF title_error %][% title_error %][% ELSE %]<translate>Error!</translate>[% END %]</th>
- </tr>
- <tr height="5"></tr>
-
- <tr><td>[% label_error %]</td></tr>
- </table>
+
+ <div class="listtop">[% IF title_error %][% title_error %][% ELSE %]<translate>Error!</translate>[% END %]</div>
+
+ <p>[% label_error %]</p>
+
+ [%- IF SHOW_BACK_BUTTON %]
+ <form>
+ <p>
+ <input type="button" onclick="history.back()" value="<translate>Back</translate>">
+ </p>
+ </form>
+
+ [%- ELSIF SHOW_BUTTON %]
+
+ <form action="[% HTML.escape(script) %]" method="post">
+
+ [%- FOREACH var = VARIABLES %]
+ <input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
+ [%- END %]
+
+ <input type="hidden" name="action" value="[% HTML.escape(action) %]">
+
+ <p>
+ <input type="submit" value="[% BUTTON_LABEL %]">
+ </p>
+ </form>
+
+ [%- END %]
</body>
</html>