Bug 22544: Move del_opac_new to Koha namespace
[koha-ffzg.git] / tools / upload.pl
index afb7c51..cf9a2c6 100755 (executable)
@@ -36,12 +36,12 @@ 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",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { tools => 'upload_general_files' },
     }
 );
@@ -59,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