Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 13b00f5a

Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt

  • ID 13b00f5a77d95d98d14856f6a8058753d28861e3
  • Vorgänger 4d4ca4a5
  • Nachfolger 73a215a8

Einfachen Presenter f. Webdav-Objekte

Unterschiede anzeigen:

SL/Presenter/WebdavObject.pm
1
package SL::Presenter::WebdavObject;
2

  
3
use strict;
4

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

  
8
use Exporter qw(import);
9
our @EXPORT_OK = qw(webdav_object);
10

  
11
use Carp;
12

  
13
sub webdav_object {
14
  my ($webdav_object, %params) = @_;
15

  
16

  
17
  my $text = escape($webdav_object->filename);
18
  if (! delete $params{no_link}) {
19
    my $href  = SL::Presenter::EscapedText::escape($webdav_object->full_filedescriptor);
20
    $text     = link_tag($href, $text, %params);
21
  }
22

  
23
  is_escaped($text);
24
}
25

  
26
1;
27

  
28

  
29
__END__
30

  
31
=pod
32

  
33
=encoding utf8
34

  
35
=head1 NAME
36

  
37
SL::Presenter::WebdavObject - Presenter module for SL::Webdav::Object(s).
38

  
39
=head1 SYNOPSIS
40

  
41
  my $webdav = SL::Webdav->new(
42
    type     => 'sales_order',
43
    number   => '1234',
44
  );
45
  my @all_objects = $webdav->get_all_objects;
46
  my $html        = SL::Presenter::WebdavObject::webdav_object($all_objects[0], no_link => 1);
47

  
48
=head1 FUNCTIONS
49

  
50
=over 4
51

  
52
=item C<webdav_object $webdav_object, %params>
53

  
54
Returns a rendered version (actually an instance of
55
L<SL::Presenter::EscapedText>) of the webdav object
56
C<$webdav_object>.
57

  
58
C<%params> can include:
59

  
60
=over 2
61

  
62
=item * no_link
63

  
64
If falsish (the default) then the file name of the object will be linked
65
to the download path for that file.
66

  
67
=back
68

  
69
=back
70

  
71
=head1 BUGS
72

  
73
Nothing here yet.
74

  
75
=head1 AUTHOR
76

  
77
Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
78

  
79
=cut

Auch abrufbar als: Unified diff