Bugzilla – Attachment 115373 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.83 KB, created by
Mazen Khallaf
on 2021-01-19 22:57:57 UTC
(
hide
)
Description:
Bug 25476: Add ability to browse file uploads by category
Filename:
MIME Type:
Creator:
Mazen Khallaf
Created:
2021-01-19 22:57:57 UTC
Size:
3.83 KB
patch
obsolete
>From 2794759fc2be6ba0d7aa7a8e083ac895cc018eb4 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 > >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> >--- > .../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 3ed10dcae3..ca427dad96 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -94,6 +94,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 %] >@@ -221,6 +246,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