Browse Source

Bug 6874: Clean up file URL generation

This adds a dependency on bug 5010, in that the protocol is
assumed in the OpacBaseURL system preference. It also adds
improved error handling.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
3.22.x
Mark Tompsett 10 years ago
committed by Tomas Cohen Arazi
parent
commit
a6408148ba
  1. 9
      cataloguing/value_builder/upload.pl
  2. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt
  3. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt

9
cataloguing/value_builder/upload.pl

@ -100,9 +100,12 @@ sub plugin {
my $fh = $input->upload('uploaded_file');
$id = C4::UploadedFiles::UploadFile($uploaded_file, $dir, $fh->handle);
if($id) {
my $OPACBaseURL = C4::Context->preference('OPACBaseURL');
$OPACBaseURL =~ s#/$##;
my $OPACBaseURL = C4::Context->preference('OPACBaseURL') // '';
$OPACBaseURL =~ s#/$##;
if (!$OPACBaseURL) {
$template->param(MissingURL => 1);
}
if($id && $OPACBaseURL) {
my $return = "$OPACBaseURL/cgi-bin/koha/opac-retrieve-file.pl?id=$id";
$template->param(
success => 1,

7
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload.tt

@ -56,9 +56,12 @@
[% ELSE %]
[% IF ( error ) %]
[% IF ( MissingURL ) %]
<p>Error: The OPAC system preference OPACBaseURL is not configured.</p>
<p><input type="button" value="close" onclick="window.close();" /></p>
[% ELSIF ( error ) %]
<p>Error: Failed to upload file. See logs for details.</p>
<input type="button" value="close" onclick="window.close();" />
<p><input type="button" value="close" onclick="window.close();" /></p>
[% ELSE %]
[%# This block display recursively a directory tree in variable 'dirs' %]
[% BLOCK list_dirs %]

7
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/upload_delete_file.tt

@ -38,8 +38,11 @@
[% ELSE %]
[% IF ( error ) %]
Error: Unable to delete the file.
[% IF ( MissingURL ) %]
<p>Error: The OPAC system preference OPACBaseURL is not configured.</p>
<p><input type="button" value="close" onclick="window.close();" /></p>
[% ELSIF ( error ) %]
<p>Error: Unable to delete the file.</p>
<p><input type="button" value="close" onclick="window.close();" /></p>
[% ELSE %]
<h2>File deletion</h2>

Loading…
Cancel
Save