From 9a76e63867b2f4a8b66fca6920f9d50f0ddc2fea Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 19 Aug 2015 15:01:04 +0200 Subject: [PATCH] Bug 14321: Just some documentation lines added or fixed Content-Type: text/plain; charset=utf-8 Test plan: Actually, you cannot really test this. But you could run the unit test again. --- Koha/Upload.pm | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/Koha/Upload.pm b/Koha/Upload.pm index 1468a4f..0014509 100644 --- a/Koha/Upload.pm +++ b/Koha/Upload.pm @@ -1,5 +1,7 @@ package Koha::Upload; +# Copyright 2007 LibLime, Galen Charlton +# Copyright 2011-2012 BibLibre # Copyright 2015 Rijksmuseum # # This file is part of Koha. @@ -25,23 +27,34 @@ Koha::Upload - Facilitate file upload use Koha::Upload; -=head1 DESCRIPTION - - This class + # add an upload (see tools/upload-file.pl) + my $upload = Koha::Upload->new( public => 1, category => 'A' ); + my $cgi = $upload->cgi; + # Do something with $upload->count, $upload->result or $upload->err -=head1 METHODS - -=head2 new + # get some upload records + my @uploads = Koha::Upload->new->get( term => $term ); + $template->param( uploads => \@uploads ); - Create object (via Class::Accessor). + # download + my $rec = Koha::Upload->new->get({ id => $id, filehandle => 1 }); + my $fh = $rec->{fh}; + my @hdr = Koha::Upload->httpheaders( $rec->{name} ); + print Encode::encode_utf8( $input->header( @hdr ) ); + while( <$fh> ) { print $_; } + $fh->close; -=head1 PROPERTIES + # delete an upload + my ( $fn ) = Koha::Upload->new->delete({ id => $id }); -=head2 ??? +=head1 DESCRIPTION - ??? + This module is a refactored version of C4::UploadedFile but adds on top + of that the new functions from report 6874 (Upload plugin in editor). + That report added module UploadedFiles.pm. This module contains the + functionality of both. -=head1 ADDITIONAL COMMENTS +=head1 METHODS =cut @@ -78,7 +91,7 @@ sub new { =head2 cgi - Returns new object based on Class::Accessor. + Returns CGI object. The CGI hook is used to store the uploaded files. =cut @@ -109,7 +122,7 @@ sub count { =head2 result - Returns new object based on Class::Accessor. + Returns a string of id's for each successful upload separated by commas. =cut @@ -140,8 +153,9 @@ sub err { =head2 get - Returns array - optional parameter: filehandle => 1 (name, path only by default) + Returns arrayref of uploaded records (hash) or one uploaded record. + You can pass id => $id or hashvalue => $hash or term => $term. + Optional parameter filehandle => 1 returns you a filehandle too. =cut @@ -400,7 +414,8 @@ sub _compute { =head1 AUTHOR - Marcel de Rooy, Rijksmuseum Amsterdam, The Netherlands + Koha Development Team + Larger parts from Galen Charlton, Julian Maurice and Marcel de Rooy =cut -- 1.7.10.4