Bugzilla – Attachment 49946 Details for
Bug 11317
Add a way to access files from the intranet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11317 - Rename config to 'accessdir' and fix qa
Bug-11317---Rename-config-to-accessdir-and-fix-qa.patch (text/plain), 9.37 KB, created by
Nick Clemens
on 2016-04-06 01:15:21 UTC
(
hide
)
Description:
Bug 11317 - Rename config to 'accessdir' and fix qa
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2016-04-06 01:15:21 UTC
Size:
9.37 KB
patch
obsolete
>From 0a265a42c5b336cae342da188eb21e12f4a9e58e Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Thu, 3 Mar 2016 10:06:39 -0500 >Subject: [PATCH] Bug 11317 - Rename config to 'accessdir' and fix qa > >Also translate date with datetime format preference and move to Tools. > >Test preparation : >* Add the "accessdir" preference to your "koha-conf.xml" file. This >* preference should be in the "config" section. For this test cas, we >* will use the "/tmp/files-access" directory : ><config> > ... > <accessdir>/tmp/files-access</accessdir> > ... ></config> >* Create the log directory on your server. Make sure this directory >* is readable by your web server : >$ mkdir /tmp/files-access >* Add a test file in the log directory : >$ cd /tmp/files-access >$ echo "Hello world!" > test.txt > >Test : >* Go in the "tools/Additional tools" section in the intranet and select "Report/log >* files" >* The "test.txt" should appear in the files list. >* Click on the "test.txt" file, a download dialog should appear. >* Download the file and verify its content. It should contain the >* text "Hello world!". > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > debian/templates/koha-conf-site.xml.in | 3 ++ > etc/koha-conf.xml | 3 ++ > .../prog/en/modules/reports/report_files.tt | 21 ++++++----- > .../prog/en/modules/reports/reports-home.tt | 1 - > .../prog/en/modules/tools/tools-home.tt | 3 ++ > reports/report_files.pl | 42 +++++++++++++--------- > 6 files changed, 44 insertions(+), 29 deletions(-) > >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 25ac182..88e02d4 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -290,6 +290,9 @@ __END_SRU_PUBLICSERVER__ > Use a comma-separated list of levels to include. --> > <!-- <zebra_loglevels>none,fatal,warn</zebra_loglevels> --> > >+ <!-- Accessible directory from the staff client, uncomment the following line and define a valid path to let the intranet user access it--> >+ <!-- <accessdir></accessdir> --> >+ > <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm --> > <ttf> > <font type="TR" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font> >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index c361846..e27c32e 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -120,6 +120,9 @@ __PAZPAR2_TOGGLE_XML_POST__ > <!-- Secret passphrase used by Mojolicious for signed cookies --> > <api_secret_passphrase>CHANGEME</api_secret_passphrase> > >+ <!-- Accessible directory from the staff client, uncomment the following line and define a valid path to let the intranet user access it--> >+ <!-- <accessdir></accessdir> --> >+ > <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm --> > <ttf> > <font type="TR" >__FONT_DIR__/DejaVuSerif.ttf</font> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt >index 3ee409e..06de9d1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report_files.tt >@@ -2,12 +2,11 @@ > <title>Report/log files</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables.inc' %] > [% INCLUDE 'datatables-strings.inc' %] >-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> > <script type="text/JavaScript" language="JavaScript"> >- //<![CDATA[ >- $(document).ready(function() { >+ //<![CDATA[ >+ $(document).ready(function() { > $("#files").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', > "aoColumnDefs": [ >@@ -15,8 +14,8 @@ > ], > "bPaginate": false > })); >- }); >- //]]> >+ }); >+ //]]> > </script> > </head> > <body> >@@ -27,13 +26,13 @@ > > <div id="doc3" class="yui-t2"> > <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >+ <div id="yui-main"> >+ <div class="yui-b"> > >- <h1>Report/log files</h1> >+ <h1>Report/log files</h1> > >-[% IF ( error_no_publiclogdir ) %] >- <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> >+[% IF ( error_no_dir ) %] >+ <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> > [% ELSE %] > [% IF ( files_loop ) %] > <table id="files"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >index d74e25f..fde9ad3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >@@ -66,7 +66,6 @@ > <li><a href="http://schema.koha-community.org/" target="blank">Koha database schema</a></li> > <li><a href="http://wiki.koha-community.org/wiki/SQL_Reports_Library" target="blank">Koha reports library</a></li> > <!--<li><a href="/cgi-bin/koha/reports/stats.screen.pl">Till reconciliation</a></li> --> >- <li><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files</a></li> > </ul></div> > </div> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 514900a..d9ed604 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -109,6 +109,9 @@ > <dd>Manage EDIfact transmissions</dd> > [% END %] > >+ <dt><a href="/cgi-bin/koha/reports/report_files.pl">Report/log files </a></dt> >+ <dd>Report/log files</dd> >+ > </dl> > </div> > <div class="yui-u"> >diff --git a/reports/report_files.pl b/reports/report_files.pl >index 3976ecb..dc319e5 100755 >--- a/reports/report_files.pl >+++ b/reports/report_files.pl >@@ -3,14 +3,14 @@ > # Frédérick Capovilla, 2011 - Libéo > # > # Show a list of all the files in the directory specified by the option >-# "publiclogdir" in koha-conf.xml so they can be downloaded by users with the >+# "accessdir" in koha-conf.xml so they can be downloaded by users with the > # "reports" permission. > # > # This file is part of Koha. > # > # Koha is free software; you can redistribute it and/or modify it under the > # terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 2 of the License, or (at your option) any later >+# Foundation; either version 3 of the License, or (at your option) any later > # version. > # > # Koha is distributed in the hope that it will be useful, but WITHOUT ANY >@@ -33,32 +33,39 @@ use Digest::MD5 qw(md5_hex); > > my $input = new CGI; > my $file_id = $input->param("id"); >-my $directory = C4::Context->config('publiclogdir'); >+my $directory = C4::Context->config('accessdir'); > > my ($template, $borrowernumber, $cookie) >- = get_template_and_user({template_name => "reports/report_files.tt", >- query => $input, >- type => "intranet", >- authnotrequired => 0, >- flagsrequired => {reports => '*'}, >- }); >+ = get_template_and_user({template_name => "reports/report_files.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => {reports => '*'}, >+ }); > > unless($directory) { >- $template->param(error_no_publiclogdir => 1); >+ $template->param(error_no_dir => 1); > } > else { > #Get the files list > my @files_list; >- opendir(DIR, $directory); >+ opendir(DIR, $directory); > > foreach my $filename (readdir(DIR)) { >- my $id = md5_hex($filename); >+ my $id = md5_hex($filename); > my $full_path = "$directory/$filename"; > next if ($filename =~ /^\./ or -d $full_path); > > my $st = stat($full_path); >+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime($st->mtime); >+ my $dt=DateTime->new(year => $year + 1900, >+ month => $mon + 1, >+ day => $mday, >+ hour => $hour, >+ minute => $min, >+ ); > push(@files_list, {name => $filename, >- date => scalar localtime($st->mtime), >+ date =>Koha::DateUtils::output_pref($dt), > size => $st->size, > id => $id}); > } >@@ -75,14 +82,15 @@ else { > -Content_length => -s "$directory/$filename", > -attachment => "$filename"); > >- open FILE, "<:utf8", "$directory/$filename"; >- binmode FILE; >+ my $fh; >+ open $fh, "<:encoding(UTF-8)", "$directory/$filename"; >+ binmode $fh; > > my $buf; >- while(read(FILE, $buf, 65536)) { >+ while(read($fh, $buf, 65536)) { > print $buf; > } >- close FILE; >+ close $fh; > > exit(1); > } >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11317
:
23203
|
25387
|
27492
|
27579
|
27604
|
35938
|
35939
|
35940
|
36844
|
39783
|
39784
|
39785
|
39786
|
44859
|
44860
|
48629
|
48635
|
49941
|
49942
|
49943
|
49944
|
49945
|
49946
|
49947
|
50421
|
50424
|
50425
|
50440
|
53446
|
58220
|
58221
|
58222
|
58223
|
58224
|
58225
|
58226
|
62971
|
62972
|
62973
|
62974
|
62975
|
64088
|
64089
|
65691
|
65851
|
65855
|
65856
|
65857
|
65909
|
65910
|
65911
|
65912
|
65913
|
65914
|
65915
|
65918
|
66091
|
66092
|
66093
|
66094
|
66095
|
66096
|
66097
|
66098
|
66099
|
66100
|
72097
|
72309
|
72456
|
72457
|
72458
|
72459
|
72460
|
72461
|
72462
|
72463
|
72464
|
72465
|
74119
|
74379
|
74756
|
74911
|
74912
|
74916
|
74917
|
74918
|
74919
|
75019