View | Details | Raw Unified | Return to bug 11317
Collapse All | Expand All

(-)a/debian/templates/koha-conf-site.xml.in (-1 / +4 lines)
Lines 299-305 __END_SRU_PUBLICSERVER__ Link Here
299
 <!-- Secret passphrase used by Mojolicious for signed cookies -->
299
 <!-- Secret passphrase used by Mojolicious for signed cookies -->
300
 <api_secret_passphrase>__API_SECRET__</api_secret_passphrase>
300
 <api_secret_passphrase>__API_SECRET__</api_secret_passphrase>
301
301
302
 <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm -->
302
 <!-- Accessible directory from the staff client, uncomment the following line and define a valid path to let the intranet user access it-->
303
 <!-- <accessdir></accessdir> -->
304
305
 <!-- true type font mapping according to type from $font_types in C4/Creators/Lib.pm -->
303
 <ttf>
306
 <ttf>
304
    <font type="TR" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font>
307
    <font type="TR" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font>
305
    <font type="TB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf</font>
308
    <font type="TB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf</font>
(-)a/etc/koha-conf.xml (+3 lines)
Lines 130-135 __PAZPAR2_TOGGLE_XML_POST__ Link Here
130
 <!-- Secret passphrase used by Mojolicious for signed cookies -->
130
 <!-- Secret passphrase used by Mojolicious for signed cookies -->
131
 <api_secret_passphrase>CHANGEME</api_secret_passphrase>
131
 <api_secret_passphrase>CHANGEME</api_secret_passphrase>
132
132
133
 <!-- Accessible directory from the staff client, uncomment the following line and define a valid path to let the intranet user access it-->
134
 <!-- <accessdir></accessdir> -->
135
133
 <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm -->
136
 <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm -->
134
 <ttf>
137
 <ttf>
135
    <font type="TR" >__FONT_DIR__/DejaVuSerif.ttf</font>
138
    <font type="TR" >__FONT_DIR__/DejaVuSerif.ttf</font>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt (-11 / +10 lines)
Lines 2-13 Link Here
2
<title>Report/log files</title>
2
<title>Report/log files</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
5
[% INCLUDE 'datatables.inc' %]
6
[% INCLUDE 'datatables-strings.inc' %]
6
[% INCLUDE 'datatables-strings.inc' %]
7
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
8
<script type="text/JavaScript" language="JavaScript">
7
<script type="text/JavaScript" language="JavaScript">
9
	//<![CDATA[
8
    //<![CDATA[
10
		$(document).ready(function() {
9
        $(document).ready(function() {
11
            $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
10
            $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
12
                "sDom": 't',
11
                "sDom": 't',
13
                "aoColumnDefs": [
12
                "aoColumnDefs": [
Lines 15-22 Link Here
15
                ],
14
                ],
16
                "bPaginate": false
15
                "bPaginate": false
17
            }));
16
            }));
18
	});
17
    });
19
	//]]>
18
    //]]>
20
</script>
19
</script>
21
</head>
20
</head>
22
<body>
21
<body>
Lines 27-39 Link Here
27
26
28
<div id="doc3" class="yui-t2">
27
<div id="doc3" class="yui-t2">
29
   <div id="bd">
28
   <div id="bd">
30
	<div id="yui-main">
29
    <div id="yui-main">
31
	<div class="yui-b">
30
    <div class="yui-b">
32
31
33
	<h1>Report/log files</h1>
32
    <h1>Report/log files</h1>
34
33
35
[% IF ( error_no_publiclogdir ) %]
34
[% IF ( error_no_dir ) %]
36
    <div class="dialog alert"><strong>Error : </strong>Report/log files could not be found because the "publiclogdir" option was not set in "koha-conf.xml". Contact your system administrator to add this option.</div>
35
    <div class="dialog alert"><strong>Error : </strong>Report/log files could not be found because the "accessdir" option was not set in "koha-conf.xml". Contact your system administrator to add this option.</div>
37
[% ELSE %]
36
[% ELSE %]
38
    [% IF ( files_loop ) %]
37
    [% IF ( files_loop ) %]
39
        <table id="files">
38
        <table id="files">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+4 lines)
Lines 113-118 Link Here
113
    <dt><a href="/cgi-bin/koha/tools/upload.pl">Upload</a></dt>
113
    <dt><a href="/cgi-bin/koha/tools/upload.pl">Upload</a></dt>
114
    <dd>Upload any type of file, manage uploads</dd>
114
    <dd>Upload any type of file, manage uploads</dd>
115
    [% END %]
115
    [% END %]
116
117
    <dt><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files </a></dt>
118
    <dd>Report/log files</dd>
119
116
</dl>
120
</dl>
117
</div>
121
</div>
118
122
(-)a/reports/report_files.pl (-18 / +25 lines)
Lines 3-16 Link Here
3
# Frédérick Capovilla, 2011 - Libéo
3
# Frédérick Capovilla, 2011 - Libéo
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
# "publiclogdir" 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
# "reports" permission.
8
#
8
#
9
# This file is part of Koha.
9
# This file is part of Koha.
10
#
10
#
11
# Koha is free software; you can redistribute it and/or modify it under the
11
# Koha is free software; you can redistribute it and/or modify it under the
12
# terms of the GNU General Public License as published by the Free Software
12
# terms of the GNU General Public License as published by the Free Software
13
# Foundation; either version 2 of the License, or (at your option) any later
13
# Foundation; either version 3 of the License, or (at your option) any later
14
# version.
14
# version.
15
#
15
#
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
Lines 33-64 use Digest::MD5 qw(md5_hex); Link Here
33
33
34
my $input      = new CGI;
34
my $input      = new CGI;
35
my $file_id = $input->param("id");
35
my $file_id = $input->param("id");
36
my $directory = C4::Context->config('publiclogdir');
36
my $directory = C4::Context->config('accessdir');
37
37
38
my ($template, $borrowernumber, $cookie)
38
my ($template, $borrowernumber, $cookie)
39
	= get_template_and_user({template_name => "reports/report_files.tt",
39
    = get_template_and_user({template_name => "reports/report_files.tt",
40
				query => $input,
40
                query => $input,
41
				type => "intranet",
41
                type => "intranet",
42
				authnotrequired => 0,
42
                authnotrequired => 0,
43
				flagsrequired => {reports => '*'},
43
                flagsrequired => {reports => '*'},
44
				});
44
                });
45
45
46
unless($directory) {
46
unless($directory) {
47
    $template->param(error_no_publiclogdir => 1);
47
    $template->param(error_no_dir => 1);
48
}
48
}
49
else {
49
else {
50
    #Get the files list
50
    #Get the files list
51
    my @files_list;
51
    my @files_list;
52
	opendir(DIR, $directory);
52
    opendir(DIR, $directory);
53
53
54
    foreach my $filename (readdir(DIR)) {
54
    foreach my $filename (readdir(DIR)) {
55
	my $id = md5_hex($filename);
55
    my $id = md5_hex($filename);
56
        my $full_path = "$directory/$filename";
56
        my $full_path = "$directory/$filename";
57
        next if ($filename =~ /^\./ or -d $full_path);
57
        next if ($filename =~ /^\./ or -d $full_path);
58
58
59
        my $st = stat($full_path);
59
        my $st = stat($full_path);
60
        my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime($st->mtime);
61
        my $dt=DateTime->new(year      => $year + 1900,
62
                              month    => $mon + 1,
63
                              day      => $mday,
64
                              hour     => $hour,
65
                              minute   => $min,
66
                        );
60
        push(@files_list, {name => $filename,
67
        push(@files_list, {name => $filename,
61
                           date => scalar localtime($st->mtime),
68
                           date =>Koha::DateUtils::output_pref($dt),
62
                           size => $st->size,
69
                           size => $st->size,
63
                           id   => $id});
70
                           id   => $id});
64
    }
71
    }
Lines 75-88 else { Link Here
75
                             -Content_length => -s "$directory/$filename",
82
                             -Content_length => -s "$directory/$filename",
76
                             -attachment => "$filename");
83
                             -attachment => "$filename");
77
84
78
        open FILE, "<:utf8", "$directory/$filename";
85
        my $fh;
79
        binmode FILE;
86
        open $fh, "<:encoding(UTF-8)", "$directory/$filename";
87
        binmode $fh;
80
88
81
        my $buf;
89
        my $buf;
82
        while(read(FILE, $buf, 65536)) {
90
        while(read($fh, $buf, 65536)) {
83
            print $buf;
91
            print $buf;
84
        }
92
        }
85
        close FILE;
93
        close $fh;
86
94
87
        exit(1);
95
        exit(1);
88
    }
96
    }
89
- 

Return to bug 11317