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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt (-9 / +8 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-36 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_publicdir ) %]
34
[% IF ( error_no_publicdir ) %]
36
    <div class="dialog alert"><strong>Error : </strong>Report/log files could not be found because the "publicdir" 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 "publicdir" option was not set in "koha-conf.xml". Contact your system administrator to add this option.</div>
(-)a/reports/report_files.pl (-14 / +14 lines)
Lines 10-16 Link Here
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 36-47 my $file_id = $input->param("id"); Link Here
36
my $directory = C4::Context->config('publicdir');
36
my $directory = C4::Context->config('publicdir');
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_publicdir => 1);
47
    $template->param(error_no_publicdir => 1);
Lines 49-58 unless($directory) { Link Here
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
Lines 75-88 else { Link Here
75
                             -Content_length => -s "$directory/$filename",
75
                             -Content_length => -s "$directory/$filename",
76
                             -attachment => "$filename");
76
                             -attachment => "$filename");
77
77
78
        open FILE, "<:utf8", "$directory/$filename";
78
        my $fh;
79
        binmode FILE;
79
        open $fh, "<:encoding(UTF-8)", "$directory/$filename";
80
        binmode $fh;
80
81
81
        my $buf;
82
        my $buf;
82
        while(read(FILE, $buf, 65536)) {
83
        while(read($fh, $buf, 65536)) {
83
            print $buf;
84
            print $buf;
84
        }
85
        }
85
        close FILE;
86
        close $fh;
86
87
87
        exit(1);
88
        exit(1);
88
    }
89
    }
89
- 

Return to bug 11317