Bug 14237: Add individual bibliographic records to course reserves
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / detail.tt
index 9000008..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">
             </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 %]
                         [% 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 %]">
+                                <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>
 [% 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>
 
                                 <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>
@@ -390,7 +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" data-order="[% item.publisheddate | html %]">
+                        [% 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>
@@ -951,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 %]
 
@@ -1011,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 %]";
@@ -1018,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();
@@ -1039,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(){