Bug 10632 - Enable datatables for courses and course details in the OPAC
[srvgit] / opac / opac-downloadshelf.pl
index 1057a16..012e51b 100755 (executable)
@@ -36,7 +36,7 @@ my $query = new CGI;
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
     {
-        template_name   => "opac-downloadshelf.tmpl",
+        template_name   => "opac-downloadshelf.tt",
         query           => $query,
         type            => "opac",
         authnotrequired => 1,
@@ -46,13 +46,14 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
 
 my $shelfid = $query->param('shelfid');
 my $format  = $query->param('format');
+my $context = $query->param('context');
+my $showprivateshelves = $query->param('showprivateshelves');
 my $dbh     = C4::Context->dbh;
 
 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $shelfid, 'view' ) ) {
 
     if ($shelfid && $format) {
 
-        my @shelf               = GetShelf($shelfid);
         my ($items, $totitems)  = GetShelfContents($shelfid);
         my $marcflavour         = C4::Context->preference('marcflavour');
         my $output;
@@ -95,12 +96,28 @@ if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh
         print $output;
 
     } else {
-        $template->param(csv_profiles => GetCsvProfilesLoop());
-        $template->param(shelfid => $shelfid); 
+
+        # get details of the list
+        my ($shelfnumber,$shelfname,$owner,$category,$sorton) = GetShelf($shelfid);
+
+        # if modal context is passed set a variable so that page markup can be different
+        if($context eq "modal"){
+            $template->param(modal => 1);
+        } else {
+            $template->param(fullpage => 1);
+        }
+        $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+        $template->param(
+            showprivateshelves  => $showprivateshelves,
+            shelfid             => $shelfid,
+            shelfname           => $shelfname,
+            shelfnumber         => $shelfnumber,
+            viewshelf           => $shelfnumber
+        );
         output_html_with_http_headers $query, $cookie, $template->output;
     }
 
 } else {
     $template->param(invalidlist => 1); 
     output_html_with_http_headers $query, $cookie, $template->output;
-}
\ No newline at end of file
+}