Revision 3a91ef77
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/Controller/Letter.pm | ||
---|---|---|
23 | 23 |
use SL::Webdav::File; |
24 | 24 |
|
25 | 25 |
use Rose::Object::MakeMethods::Generic ( |
26 |
'scalar --get_set_init' => [ qw(letter all_employees models) ], |
|
26 |
'scalar --get_set_init' => [ qw(letter all_employees models webdav_objects) ],
|
|
27 | 27 |
); |
28 | 28 |
|
29 | 29 |
__PACKAGE__->run_before('check_auth_edit'); |
... | ... | |
598 | 598 |
SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); |
599 | 599 |
} |
600 | 600 |
|
601 |
sub init_webdav_objects { |
|
602 |
my ($self) = @_; |
|
603 |
|
|
604 |
return [] if !$self->letter || !$self->letter->letternumber || !$::instance_conf->get_webdav; |
|
605 |
|
|
606 |
my $webdav = SL::Webdav->new( |
|
607 |
type => 'letter', |
|
608 |
number => $self->letter->letternumber, |
|
609 |
); |
|
610 |
|
|
611 |
my $webdav_path = $webdav->webdav_path; |
|
612 |
my @all_objects = $webdav->get_all_objects; |
|
613 |
|
|
614 |
return [ map { |
|
615 |
+{ name => $_->filename, |
|
616 |
type => t8('File'), |
|
617 |
link => File::Spec->catdir($webdav_path, $_->filename), |
|
618 |
} |
|
619 |
} @all_objects ]; |
|
620 |
} |
|
621 |
|
|
601 | 622 |
sub check_auth_edit { |
602 | 623 |
$::auth->assert('sales_letter_edit'); |
603 | 624 |
} |
templates/webpages/letter/edit.html | ||
---|---|---|
3 | 3 |
[%- USE L %] |
4 | 4 |
[%- USE P %] |
5 | 5 |
[%- USE LxERP %] |
6 |
[%- SET WEBDAV = SELF.webdav_objects %] |
|
6 | 7 |
<h1>[% title | html %]</h1> |
7 | 8 |
|
8 | 9 |
<form action='controller.pl' method='POST'> |
... | ... | |
16 | 17 |
<ul> |
17 | 18 |
<li><a href="#ui-tabs-letter">[% LxERP.t8("Letter") %]</a></li> |
18 | 19 |
[%- IF letter.id %] |
20 |
[%- IF INSTANCE_CONF.get_webdav %] |
|
21 |
<li><a href="#ui-tabs-webdav">[% LxERP.t8('WebDAV') %]</a></li> |
|
22 |
[%- END %] |
|
19 | 23 |
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Letter&object_id=[% HTML.url(letter.id) %]">[% LxERP.t8("Linked Records") %]</a></li> |
20 | 24 |
[%- END %] |
21 | 25 |
</ul> |
... | ... | |
136 | 140 |
</table> |
137 | 141 |
|
138 | 142 |
</div> |
143 |
[% PROCESS 'webdav/_list.html' %] |
|
139 | 144 |
<div id="ui-tabs-1"> |
140 | 145 |
[%- LxERP.t8("Loading...") %] |
141 | 146 |
</div> |
Auch abrufbar als: Unified diff
Brieffunktion: WebDAV-Verzeichnisinhalt anzeigen