|
Lines 4-10
Link Here
|
| 4 |
# |
4 |
# |
| 5 |
# Show a list of all the files in the directory specified by the option |
5 |
# Show a list of all the files in the directory specified by the option |
| 6 |
# "accessdir" in koha-conf.xml so they can be downloaded by users with the |
6 |
# "accessdir" in koha-conf.xml so they can be downloaded by users with the |
| 7 |
# "reports" permission. |
7 |
# "access_files" permission. |
| 8 |
# |
8 |
# |
| 9 |
# This file is part of Koha. |
9 |
# This file is part of Koha. |
| 10 |
# |
10 |
# |
|
Lines 23-34
Link Here
|
| 23 |
|
23 |
|
| 24 |
use strict; |
24 |
use strict; |
| 25 |
use warnings; |
25 |
use warnings; |
|
|
26 |
|
| 26 |
use C4::Auth; |
27 |
use C4::Auth; |
| 27 |
use CGI; |
28 |
use CGI; |
| 28 |
use C4::Context; |
29 |
use C4::Context; |
| 29 |
use C4::Output; |
30 |
use C4::Output; |
| 30 |
use C4::Koha; |
31 |
use C4::Koha; |
| 31 |
use File::stat; |
32 |
use File::stat qw(stat); |
| 32 |
use Digest::MD5 qw(md5_hex); |
33 |
use Digest::MD5 qw(md5_hex); |
| 33 |
|
34 |
|
| 34 |
my $input = new CGI; |
35 |
my $input = new CGI; |
|
Lines 37-47
my $accessdir = C4::Context->config('accessdir');
Link Here
|
| 37 |
my @directories = $accessdir ? (ref $accessdir ? @{$accessdir} : ($accessdir)) : (); |
38 |
my @directories = $accessdir ? (ref $accessdir ? @{$accessdir} : ($accessdir)) : (); |
| 38 |
|
39 |
|
| 39 |
my ($template, $borrowernumber, $cookie) |
40 |
my ($template, $borrowernumber, $cookie) |
| 40 |
= get_template_and_user({template_name => "reports/report_files.tt", |
41 |
= get_template_and_user({template_name => "tools/access_files.tt", |
| 41 |
query => $input, |
42 |
query => $input, |
| 42 |
type => "intranet", |
43 |
type => "intranet", |
| 43 |
authnotrequired => 0, |
44 |
authnotrequired => 0, |
| 44 |
flagsrequired => {reports => '*'}, |
45 |
flagsrequired => { tools => 'access_files' }, |
| 45 |
}); |
46 |
}); |
| 46 |
|
47 |
|
| 47 |
unless(@directories) { |
48 |
unless(@directories) { |
|
Lines 76-82
else {
Link Here
|
| 76 |
|
77 |
|
| 77 |
my %files_hash = map { $_->{id} => $_ } @files_list; |
78 |
my %files_hash = map { $_->{id} => $_ } @files_list; |
| 78 |
# If we received a file_id and it is valid, send the file to the browser |
79 |
# If we received a file_id and it is valid, send the file to the browser |
| 79 |
if(defined $file_id and $file_id >= 0 and exists $files_hash{$file_id} ){ |
80 |
if(defined $file_id and exists $files_hash{$file_id} ){ |
| 80 |
my $filename = $files_hash{$file_id}->{name}; |
81 |
my $filename = $files_hash{$file_id}->{name}; |
| 81 |
my $dir = $files_hash{$file_id}->{accessdir}; |
82 |
my $dir = $files_hash{$file_id}->{accessdir}; |
| 82 |
binmode STDOUT; |
83 |
binmode STDOUT; |
| 83 |
- |
|
|