Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5c184abc

Von Moritz Bunkus vor fast 17 Jahren hinzugefügt

  • ID 5c184abc6228356bbceea79cb4e2e99a62c956f9
  • Vorgänger 943901c1
  • Nachfolger 83914eeb

API-Anpassung für $form->show_generic_error(): Man kann einen JavaScript-"Zurück"-Button anzeigen lassen, oder einen Button mit beliebigem anderen Text.

Unterschiede anzeigen:

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

  
templates/webpages/generic/error_de.html
1 1
[% USE HTML %]<body>
2
 <table width="100%">
3
  <tr>
4
   <th class="listtop">[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]</th>
5
  </tr>
6
  <tr height="5"></tr>
7

  
8
  <tr><td>[% label_error %]</td></tr>
9
 </table>
2

  
3
 <div class="listtop">[% IF title_error %][% title_error %][% ELSE %]Fehler![% END %]</div>
4

  
5
 <p>[% label_error %]</p>
6

  
7
 [%- IF SHOW_BACK_BUTTON %]
8
 <form>
9
  <p>
10
   <input type="button" onclick="history.back()" value="Zur?ck">
11
  </p>
12
 </form>
13

  
14
 [%- ELSIF SHOW_BUTTON %]
15

  
16
 <form action="[% HTML.escape(script) %]" method="post">
17

  
18
  [%- FOREACH var = VARIABLES %]
19
  <input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
20
  [%- END %]
21

  
22
  <input type="hidden" name="action" value="[% HTML.escape(action) %]">
23

  
24
  <p>
25
   <input type="submit" value="[% BUTTON_LABEL %]">
26
  </p>
27
 </form>
28

  
29
 [%- END %]
10 30

  
11 31
</body>
12 32
</html>
templates/webpages/generic/error_master.html
1 1
[% USE HTML %]<body>
2
 <table width="100%">
3
  <tr>
4
   <th class="listtop">[% IF title_error %][% title_error %][% ELSE %]<translate>Error!</translate>[% END %]</th>
5
  </tr>
6
  <tr height="5"></tr>
7

  
8
  <tr><td>[% label_error %]</td></tr>
9
 </table>
2

  
3
 <div class="listtop">[% IF title_error %][% title_error %][% ELSE %]<translate>Error!</translate>[% END %]</div>
4

  
5
 <p>[% label_error %]</p>
6

  
7
 [%- IF SHOW_BACK_BUTTON %]
8
 <form>
9
  <p>
10
   <input type="button" onclick="history.back()" value="<translate>Back</translate>">
11
  </p>
12
 </form>
13

  
14
 [%- ELSIF SHOW_BUTTON %]
15

  
16
 <form action="[% HTML.escape(script) %]" method="post">
17

  
18
  [%- FOREACH var = VARIABLES %]
19
  <input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
20
  [%- END %]
21

  
22
  <input type="hidden" name="action" value="[% HTML.escape(action) %]">
23

  
24
  <p>
25
   <input type="submit" value="[% BUTTON_LABEL %]">
26
  </p>
27
 </form>
28

  
29
 [%- END %]
10 30

  
11 31
</body>
12 32
</html>

Auch abrufbar als: Unified diff