Bugzilla – Attachment 119343 Details for
Bug 25476
Uploaded files can't be easily browsed via upload.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25476: Add ability to browse file uploads by category
Bug-25476-Add-ability-to-browse-file-uploads-by-ca.patch (text/plain), 3.99 KB, created by
Marcel de Rooy
on 2021-04-09 06:35:52 UTC
(
hide
)
Description:
Bug 25476: Add ability to browse file uploads by category
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-04-09 06:35:52 UTC
Size:
3.99 KB
patch
obsolete
>From 8afd6e8d541f4e45a6d70ba08bb96ace4852bcd6 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 14 May 2020 04:00:32 +0000 >Subject: [PATCH] Bug 25476: Add ability to browse file uploads by category >Content-Type: text/plain; charset=utf-8 > >This patch adds the ability to search/browse files by category. >(Note it doesn't include temporary uploads since they don't have > a "category" per se.) > >Test Plan: >0) Apply patch >1) Go to /cgi-bin/koha/admin/authorised_values.pl >2) Create "UPLOAD" authorized value category >3) Create "test" authorized value in "UPLOAD" category >4) Go to /cgi-bin/koha/tools/upload.pl >5) Note "Search uploads by category" fieldset >6) Upload new file to "test" category >7) Click "Back" >8) Choose "test" category in "Search uploads by category" >9) Click "Search" >10) Note that your file upload is displayed in result list > >Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../intranet-tmpl/prog/en/modules/tools/upload.tt | 26 ++++++++++++++++++++++ > tools/upload.pl | 17 ++++++++++++++ > 2 files changed, 43 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >index 847940f628..6c402550bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -109,6 +109,31 @@ > </form> > [% END %] > >+[% BLOCK form_browse %] >+ [% IF uploadcategories %] >+ <form method="post" id="browsefile" action="/cgi-bin/koha/tools/upload.pl" enctype="multipart/form-data"> >+ [% PROCESS plugin_pars %] >+ <input type="hidden" name="op" value="browse"/> >+ <fieldset class="rows"> >+ <legend>Search uploads by category</legend> >+ <ol> >+ <li> >+ <label for="browsecategory">Category: </label> >+ <select id="browsecategory" name="browsecategory"> >+ [% FOREACH cat IN uploadcategories %] >+ <option value="[% cat.code | html %]">[% cat.name | html %]</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ <fieldset class="action"> >+ <button id="browsebutton" class="submit">Search</button> >+ </fieldset> >+ </fieldset> >+ </form> >+ [% END %] >+[% END %] >+ > [% BLOCK form_search %] > <form method="post" id="searchfile" action="/cgi-bin/koha/tools/upload.pl" enctype="multipart/form-data"> > [% PROCESS plugin_pars %] >@@ -236,6 +261,7 @@ > [% PROCESS submitter %] > [% IF mode == 'new' || mode == 'deleted' %] > [% PROCESS form_new %] >+ [% PROCESS form_browse %] > [% PROCESS form_search %] > [% PROCESS closer %] > [% ELSIF mode == 'report' %] >diff --git a/tools/upload.pl b/tools/upload.pl >index 61e8a22ee4..cf9a2c6053 100755 >--- a/tools/upload.pl >+++ b/tools/upload.pl >@@ -36,6 +36,7 @@ my $index = $input->param('index'); # MARC editor input field id > my $term = $input->param('term'); > my $id = $input->param('id'); > my $msg = $input->param('msg'); >+my $browsecategory = $input->param('browsecategory'); > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { template_name => "tools/upload.tt", >@@ -58,6 +59,22 @@ if ( $op eq 'new' ) { > ); > output_html_with_http_headers $input, $cookie, $template->output; > >+} elsif ( $op eq 'browse' ) { >+ my $uploads; >+ if ($browsecategory){ >+ $uploads = Koha::UploadedFiles->search({ >+ uploadcategorycode => $browsecategory, >+ $plugin? ( public => 1 ): (), >+ })->unblessed; >+ } >+ >+ $template->param( >+ mode => 'report', >+ msg => $msg, >+ uploads => $uploads, >+ ); >+ output_html_with_http_headers $input, $cookie, $template->output; >+ > } elsif ( $op eq 'search' ) { > my $uploads; > if( $id ) { # might be a comma separated list >-- >2.11.0
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 25476
:
104862
|
115373
|
118882
| 119343