X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCommon.pm;h=5ac63c6952ca6f60697d3629084d712a14c012bb;hb=44472690fcd26f0c9bd21d7e9d697dbf77c55275;hp=c67c58c003f8fc9f61b623c412b6ce5e9364e022;hpb=e436a6b05600897aed8c5420d44bf4e1b39cb74f;p=kivitendo-erp.git diff --git a/SL/Common.pm b/SL/Common.pm index c67c58c00..5ac63c695 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -260,7 +260,7 @@ sub webdav_folder { my ($path, $number); - $form->{WEBDAV} = {}; + $form->{WEBDAV} = []; if ($form->{type} eq "sales_quotation") { ($path, $number) = ("angebote", $form->{quonumber}); @@ -293,18 +293,22 @@ sub webdav_folder { $base_path =~ s|/$||; if (opendir $dir, $path) { - foreach my $file (readdir $dir) { + foreach my $file (sort { lc $a cmp lc $b } readdir $dir) { next if (($file eq '.') || ($file eq '..')); my $fname = $file; $fname =~ s|.*/||; - my $physical_file = "$path/$file"; + my $is_directory = -d "$path/$file"; $file = join('/', map { $form->escape($_) } grep { $_ } split m|/+|, "$path/$file"); - $file .= '/' if (-d $physical_file); + $file .= '/' if ($is_directory); - $form->{WEBDAV}->{$fname} = ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file"; + push @{ $form->{WEBDAV} }, { + 'name' => $fname, + 'link' => ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file", + 'type' => $is_directory ? $main::locale->text('Directory') : $main::locale->text('File'), + }; } closedir $dir;