Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ee51b82f

Von Tamino Steinert vor etwa 2 Jahren hinzugefügt

  • ID ee51b82f6206a33d436cb453ebe835d6fbbb4c2c
  • Vorgänger a0a10e44
  • Nachfolger 84dfd7a5

Presenter: nutze link_tag anstelle von html im perl-code

(cherry picked aus Kundenprojekt)

Unterschiede anzeigen:

SL/Presenter/Project.pm
3 3
use strict;
4 4

  
5 5
use SL::Presenter::EscapedText qw(escape is_escaped);
6
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag);
6
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag link_tag);
7 7

  
8 8
use Exporter qw(import);
9 9
our @EXPORT_OK = qw(project project_picker);
......
19 19

  
20 20
  croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
21 21

  
22
  my $description = $project->full_description(style => $params{style});
23
  my $callback    = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
22
  my $description = $project->full_description(style => delete $params{style});
23
  my $callback    = $params{callback} ?
24
                      '&callback=' . $::form->escape(delete $params{callback})
25
                    : '';
26

  
27
  my $text = escape($description);
28
  if (! delete $params{no_link}) {
29
    my $href = 'controller.pl?action=Project/edit'
30
               . '&id=' . escape($project->id)
31
               . $callback;
32
    $text = link_tag($href, $text, %params);
33
  }
24 34

  
25
  my $text = join '', (
26
    $params{no_link} ? '' : '<a href="controller.pl?action=Project/edit&amp;id=' . escape($project->id) . $callback . '">',
27
    escape($description),
28
    $params{no_link} ? '' : '</a>',
29
  );
30 35
  is_escaped($text);
31 36
}
32 37

  
......
81 86
Returns a rendered version (actually an instance of
82 87
L<SL::Presenter::EscapedText>) of the project object C<$customer>.
83 88

  
84
C<%params> can include:
89
Remaining C<%params> are passed to the function
90
C<SL::Presenter::Tag::link_tag>. It can include:
85 91

  
86 92
=over 2
87 93

  
88 94
=item * display
89 95

  
90
Either C<inline> (the default) or C<table-cell>. At the moment both
91
representations are identical and produce the project's description
92
(controlled by the C<style> parameter) linked to the corresponding
93
'edit' action.
96
Either C<inline> (the default) or C<table-cell>. Is passed to the function
97
C<SL::Presenter::Tag::link_tag>.
94 98

  
95 99
=item * style
96 100

  
97 101
Determines what exactly will be output. Can be one of the values with
98 102
C<both> being the default if it is missing:
99 103

  
104
=item * no_link
105

  
106
If falsish (the default) then the description will be linked to the "edit"
107
dialog.
108

  
100 109
=over 2
101 110

  
102 111
=item C<projectnumber> (or simply C<number>)

Auch abrufbar als: Unified diff