Bug 14237: Add individual bibliographic records to course reserves
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / detail.tt
index 1f9d024..494e836 100644 (file)
@@ -2,6 +2,7 @@
 [% USE Asset %]
 [% USE Koha %]
 [% USE KohaDates %]
+[% USE KohaPlugins %]
 [% USE AuthorisedValues %]
 [% USE Branches %]
 [% USE Biblio %]
     [% END %]
 [% END %]
 
+[% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
+
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Catalog &rsaquo;
+<title>
   [% IF ( unknownbiblionumber ) %]
     Unknown record
   [% ELSE %]
     Details for [% INCLUDE 'biblio-title-head.inc' %]
-  [% END %]
+  [% END %] &rsaquo; Catalog &rsaquo; Koha
 </title>
 [% INCLUDE 'doc-head-close.inc' %]
+[% Asset.css("lib/Chocolat/css/chocolat.css") | $raw %]
 </head>
 
 <body id="catalog_detail" class="catalog">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo;
-  [% IF ( unknownbiblionumber ) %]
-    Unknown record
-  [% ELSE %]
-    [% INCLUDE 'biblio-title.inc' link = 1 %] &rsaquo; Details
-  [% END %]
-</div>
+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
+    <ol>
+        <li>
+            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
+        </li>
+        <li>
+            <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
+        </li>
+
+        [% IF ( unknownbiblionumber ) %]
+            <li>
+                <a href="#" aria-current="page">
+                    Unknown record
+                </a>
+            </li>
+        [% ELSE %]
+            <li>
+                [% INCLUDE 'biblio-title.inc' link = 1 %]
+            </li>
+            <li>
+                <a href="#" aria-current="page">
+                    Details
+                </a>
+            </li>
+        [% END %]
+    </ol>
+</nav>
 
 <div class="main container-fluid">
     <div class="row">
             </span>
         [% END %]
 
+        [% IF course_reserves %]
+            <span class="results_summary"><span class="label">Courses that have reserved this title: </span>
+            [% FOREACH c IN course_reserves %]
+                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% c.course_id | uri %]">[% c.course.course_name | html %]</a>
+                [% IF ( loop.last ) %][% ELSE %]|[% END %]
+            [% END %]
+            </span>
+        [% END %]
+
         [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
             </div>
             <div class="col-xs-3 bookcoverimg">
                         [% IF localimages.count %]
                             [% FOREACH image IN localimages %]
                                 <div class="cover-image local-coverimg">
-                                    <a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
-                                        <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" />
+                                    <a href="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
+                                        <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" data-link="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" />
                                     </a>
                                     <div class="hint">Local cover image</div>
                                 </div>
 
                     [% IF ( AdlibrisEnabled && normalized_isbn ) %]
                         <div class="cover-image" id="adlibris-coverimg">
-                            <a href="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]">
-                                <img src="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" class="adlibris-cover-big" alt="Adlibris cover image" />
+                            <a href="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" title="Addlibris cover image">
+                                <img src="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" class="adlibris-cover-big" alt="Adlibris cover image" data-link="[% AdlibrisURL | url %]?isbn=[% normalized_isbn | uri %]" />
                             </a>
                             <div class="hint">Image from Adlibris</div>
                         </div>
 
                     [% IF ( AmazonCoverImages && normalized_isbn) %]
                         <div class="cover-image" id="amazon-bookcoverimg">
-                            <a href="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link">
-                                <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | html %].01.MZZZZZZZ.jpg" alt="Amazon cover image" />
+                            <a href="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.LZZZZZZZ.jpg" title="Amazon cover image">
+                                <img src="https://images-na.ssl-images-amazon.com/images/P/[% normalized_isbn | uri %].01.MZZZZZZZ.jpg" alt="Amazon cover image" data-link="http://www.amazon[% AmazonTld | uri %]/gp/reader/[% normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"/>
                             </a>
                             <div class="hint">Image from Amazon.com</div>
                         </div>
                         [% coce_id = normalized_ean || normalized_isbn %]
                         <div class="cover-image" id="coce-coverimg">
                             [% IF ( coce_id ) %]
-                                <span title="[% biblionumber | url %]" class="[% coce_id | html %]" id="coce-thumbnail-preview"></span>
+                                <a title="Image from Coce" class="[% coce_id | html %]" id="coce-thumbnail-preview"></a>
                             [% ELSE %]
                                 <span class="no-image">No cover image available</span>
                             [% END %]
                     [% END %]
 
                     [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
-                        <div class="cover-image" id="custom-coverimg">
-                            <a class="custom_cover_image" href="[% biblio.custom_cover_image_url | url %]">
-                                <img id="custom-img" alt="Custom cover image" src="[% biblio.custom_cover_image_url | url %]" />
-                            </a>
-                            <div class="hint">Custom cover image</div>
-                        </div>
+                        [% SET custom_cover_image_url = biblio.custom_cover_image_url %]
+                        [% IF custom_cover_image_url %]
+                            <div class="cover-image" id="custom-coverimg">
+                                <a class="custom_cover_image" href="[% custom_cover_image_url | url %]" title="Custom cover image">
+                                    <img id="custom-img" alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
+                                </a>
+                                <div class="hint">Custom cover image</div>
+                            </div>
+                        [% END %]
                     [% END %]
                 </div> <!-- /.cover-slider -->
             </div> <!-- /.bookcoverimg.col-xs-3 -->
 [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
     <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li>
 [% END %]
-[% FOREACH tab IN tabs %]
-    <li><a href="#[% tab.id | uri %]">[% tab.title | html %]</a></li>
+[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
+    <li><a href="#[% plugins_intranet_catalog_biblio_tab.id | uri %]">[% plugins_intranet_catalog_biblio_tab.title | html %]</a></li>
 [% END %]
 </ul>
 
                 [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
                 <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
                 [% IF volinfo %]
-                [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
-                        <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron" class="title-string">Serial enumeration / chronology</th>
-                    [% ELSE %]
-                        <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th>
-                    [% END %]
+                    <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th>
                 [% END %]
                 <th id="[% tab | html %]_status" data-colname="[% tab | html %]_status">Status</th>
-                <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen" class="title-string">Last seen</th>
-                <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned" class="title-string">Date accessioned</th>
-                <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed" class="title-string">Date last borrowed</th>
+                <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen">Last seen</th>
+                <th id="[% tab | html %]_dateaccessioned" data-colname="[% tab | html %]_dateaccessioned">Date accessioned</th>
+                <th id="[% tab | html %]_datelastborrowed" data-colname="[% tab | html %]_datelastborrowed">Date last borrowed</th>
                 <th id="[% tab | html %]_barcode" data-colname="[% tab | html %]_barcode">Barcode</th>
                 [% IF ( itemdata_uri ) %]<th id="[% tab | html %]_uri" data-colname="[% tab | html %]_uri">URL</th>[% END %]
                 [% IF ( itemdata_copynumber ) %]<th id="[% tab | html %]_copynumber" data-colname="[% tab | html %]_copynumber">Copy number</th>[% END %]
                                 <div class="cover-slider">
                                     [% FOREACH image IN item.cover_images %]
                                         <div class="cover-image local-coverimg">
-                                            <a href="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]">
+                                            <a href="/cgi-bin/koha/catalogue/image.pl?itemnumber=[% image.itemnumber | uri %]&amp;imagenumber=[% image.imagenumber | uri %]" title="Local cover image">
                                                 <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;imagenumber=[% image.imagenumber | uri %]" alt="Local cover image" />
                                             </a>
                                         </div>
@@ -371,8 +403,11 @@ Note that permanent location is a code, and location may be an authval.
                     [% IF ( itemdata_ccode ) %]<td>[% item.ccode | html %]</td>[% END %]
                     <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber | html %][% END %]</td>
                     [% IF ( volinfo ) %]
-                        <td class="enumchron">
-                            [% IF itemdata_publisheddate %]<span title="[% item.publisheddate | html %]">[% END %]
+                        [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting %]
+                            <td class="enumchron" data-order="[% item.publisheddate | html %]">
+                        [% ELSE %]
+                            <td class="enumchron">
+                        [% END %]
                             [% IF ( itemdata_enumchron ) %]
                                 [% IF item.enumchron && item.serialseq %]
                                     <span class="enum">[% item.enumchron | html %]</span>
@@ -461,7 +496,7 @@ Note that permanent location is a code, and location may be an authval.
                         [% SET hold = item.first_hold %]
                         [% IF hold %]
                             [% IF hold.waitingdate %]
-                                <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %].</span>
+                                <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %][% IF ( hold.desk_id ) %], [% hold.desk.desk_name | html %][% END %] since [% hold.waitingdate | $KohaDates %].</span>
                                 [% IF canreservefromotherbranches AND ( hold.waitingdate OR hold.priority == 1 ) %]
                                     <span class="heldfor">Hold for:</span>
                                     [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
@@ -479,9 +514,9 @@ Note that permanent location is a code, and location may be an authval.
                         [% END %]
 
                     </td>
-                    <td class="datelastseen"><span title="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</span></td>
-                    <td class="dateaccessioned"><span title="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</span></td>
-                    <td class="datelastborrowed"><span title="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</span></td>
+                    <td class="datelastseen" data-order="[% item.datelastseen | html %]">[% item.datelastseen | $KohaDates %]</td>
+                    <td class="dateaccessioned" data-order="[% item.dateaccessioned | html %]">[% item.dateaccessioned | $KohaDates %]</td>
+                    <td class="datelastborrowed" data-order="[% item.datelastborrowed | html %]">[% item.datelastborrowed | $KohaDates %]</td>
                     <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?type=[% item.type | uri %]&amp;itemnumber=[% item.itemnumber | uri %]&amp;biblionumber=[% item.biblionumber | uri %]&amp;bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td>
                     [% IF ( itemdata_uri ) %]
                         [% IF item.uri.split(' \| ').size > 1 %]
@@ -676,8 +711,8 @@ Note that permanent location is a code, and location may be an authval.
             [% FOREACH latestserial IN subscription.latestserials %]
                 <tr>
                     <td>[% latestserial.serialseq | html %]</td>
-                    <td><span title="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</span></td>
-                    <td><span title="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</span></td>
+                    <td data-order="[% latestserial.planneddate | html %]">[% latestserial.planneddate | $KohaDates %]</td>
+                    <td data-order="[% latestserial.publisheddate | html %]">[% latestserial.publisheddate | $KohaDates %]</td>
                     <td>
                       [% IF ( latestserial.status1 ) %]Expected[% END %]
                       [% IF ( latestserial.status2 ) %]Arrived[% END %]
@@ -714,14 +749,14 @@ Note that permanent location is a code, and location may be an authval.
           <th>Basket group</th>
           <th>Basket</th>
           <th>Order number</th>
-          <th class="title-string">Creation date</th>
-          <th class="title-string">Receive date</th>
+          <th>Creation date</th>
+          <th>Receive date</th>
           <th>Status</th>
           <th>Quantity</th>
           <th title="Estimated cost tax incl. while pending, actual cost tax incl. once received">Price</th>
           <th>Internal note</th>
           <th>Subscription</th>
-          <th>Subscription callnumber</th>
+          <th>Subscription call number</th>
         </tr>
       </thead>
       <tbody>
@@ -759,8 +794,8 @@ Note that permanent location is a code, and location may be an authval.
                 [% basket.basketname | html %] ([% basket.basketno | html %])
             [% END %]</td>
             <td>[% order.ordernumber | html %]</td>
-            <td><span title="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</span></td>
-            <td><span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</span></td>
+            <td data-order="[% basket.creationdate | uri %]">[% basket.creationdate | $KohaDates%]</td>
+            <td data-order="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates%]</td>
             <td>
               [% SWITCH order.orderstatus %]
                 [% CASE 'new' %]New
@@ -933,9 +968,9 @@ Note that permanent location is a code, and location may be an authval.
     </div>
 [% END %]
 
-[% FOREACH tab IN tabs %]
-    <div id="[% tab.id | html %]">
-        [% tab.content | $raw %]
+[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
+    <div id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
+        [% plugins_intranet_catalog_biblio_tab.content | $raw %]
     </div>
 [% END %]
 
@@ -993,6 +1028,7 @@ Note that permanent location is a code, and location may be an authval.
     [% INCLUDE 'catalog-strings.inc' %]
     [% Asset.js("js/catalog.js") | $raw %]
     [% Asset.js("js/coce.js") | $raw %]
+    [% Asset.js("lib/Chocolat/js/chocolat.js") | $raw %]
     <script>
         var interface = "[% interface | html %]";
         var theme = "[% theme | html %]";
@@ -1000,11 +1036,13 @@ Note that permanent location is a code, and location may be an authval.
         function verify_images() {
             // Loop over each container in the template which contains covers
             $(".cover-slider").each(function(){
+                var lightbox_descriptions = [];
                 $(this).find(".cover-image").each( function( index ){
                     var div = $(this);
                     // Find the image in the container
                     var img = div.find("img")[0];
                     if( $(img).length > 0 ){
+                        var description = "";
                         if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){
                             // No image loaded in the container. Remove the slide
                             div.remove();
@@ -1021,28 +1059,47 @@ Note that permanent location is a code, and location may be an authval.
                                     // Amazon returned single-pixel placeholder
                                     // Remove the container
                                     div.remove();
+                                } else {
+                                    lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link')));
                                 }
-                            }
-                            if( div.attr("id") == "custom-img" ){
+                            } else if( div.attr("id") == "custom-coverimg" ){
                                 if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) {
                                     // No image was loaded via the CustomCoverImages system preference
                                     // Remove the container
                                     div.remove();
+                                } else {
+                                    lightbox_descriptions.push("Custom cover image");
                                 }
-                            }
-                            if( div.attr("id") == "coce-coverimg" ){
+                            } else if( div.attr("id") == "coce-coverimg" ){
                                 // Identify which service's image is being loaded by Coce
+                                var coce_description;
                                 if( $(img).attr("src").indexOf('amazon.com') >= 0 ){
-                                    div.find(".hint").html(_("Coce image from Amazon.com"));
+                                    coce_description = ("Coce image from Amazon.com");
                                 } else if( $(img).attr("src").indexOf('google.com') >= 0 ){
-                                    div.find(".hint").html(_("Coce image from Google Books"));
+                                    coce_description = _("Coce image from Google Books");
                                 } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){
-                                    div.find(".hint").html(_("Coce image from Open Library"));
+                                    coce_description = _("Coce image from Open Library");
                                 }
+                                div.find(".hint").html(coce_description);
+                                lightbox_descriptions.push(coce_description);
+                            } else if ( div.attr("id") == "adlibris-coverimg" ){
+                                lightbox_descriptions.push(_("Image from Adlibris (<a href='%s'>see the original image</a>)").format($(img).data('link')));
+                            } else if ( div.attr("class") == "cover-image local-coverimg" ) {
+                                lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link')));
+                            } else {
+                                lightbox_descriptions.push(_("Cover image source unknown"));
                             }
                         }
                     }
                 });
+
+                // Lightbox for cover images
+                Chocolat(this.querySelectorAll('.cover-image a'), {
+                    description: function(){
+                        return lightbox_descriptions[this.settings.currentImageIndex];
+                    }
+                });
+
             });
 
             $(".cover-slider").each(function(){
@@ -1308,6 +1365,13 @@ Note that permanent location is a code, and location may be an authval.
                 }));
             [% END %]
         });
+
+        $(document).ready(function() {
+            var search_index = localStorage.getItem("cat_search_pulldown_selection");
+            var search_value = localStorage.getItem("searchbox_value");
+            if ( search_index ){ $('#cat-search-block select.advsearch').val(search_index)};
+            if ( search_value ){ $('#cat-search-block #search-form').val(search_value)};
+        });
     </script>
 [% END %]
 [% INCLUDE 'intranet-bottom.inc' %]