Teach TPAC to show jacket images by Record ID collab/bshum/added-content-by-id
authorJeff Godin <jgodin@tadl.org>
Wed, 25 Jul 2012 18:02:00 +0000 (14:02 -0400)
committerBen Shum <bshum@biblio.org>
Thu, 28 Feb 2013 04:30:19 +0000 (23:30 -0500)
Retrieve AC jackets by record ID in TPAC and include jacket image
even if we lack an ISBN/UPC.

Conditional output of the jacket image <img> tag breaks local added
content overrides by record ID. Make the inclusion of the jacket
image unconditional.

Use an onerror handler to hide broken jacket images for those cases
where we receive a 404 instead of a 1x1 placeholder.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/parts/record/cnbrowse.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2

index 661c132..d250ea1 100644 (file)
@@ -36,7 +36,8 @@
                             IF ident %]
                         <a href="[% mkurl(ctx.opac_root _ '/record/' _ cn.record.id, {$loc_name => loc_value}, 1) %]"><img height='60' width='50' 
                             class='cn_browse_info' name='cn_browse_pic' border='0'
-                            src="[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]" /></a>
+                            onerror='this.style.display="none";'
+                            src="[% ctx.media_prefix %]/opac/extras/ac/jacket/small/r/[% cn.record.id | uri %]" /></a>
                         [% END %]
                         <div class='cn_browse_info bold' name='cn_browse_cn'>[% cn.label | html %]</div>
                         <div class='cn_browse_info'>
index a38bd54..1acc5a8 100644 (file)
 [%-# This holds the record summary information %]
 <div id="rdetail_summary_header">
     <div id="rdetail_image_div">
-        [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
-        <a href='[% ctx.media_prefix %]/opac/extras/ac/jacket/large/[% ident | uri %]'><img
+        <a href='[% ctx.media_prefix %]/opac/extras/ac/jacket/large/r/[% ctx.bre_id | uri %]'><img
             alt="[% l('Image of item') %]" id='rdetail_image'
-            src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/[% ident | uri %]' /></a>
-        [% END %]
+            onerror="this.style.display='none';"
+            src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/r/[% ctx.bre_id | uri %]' /></a>
         <br />
     </div>
 
index e0f3f2a..5257a1b 100644 (file)
                                                     result_count; result_count = result_count + 1
                                                 %].</td>
                                             <td class='result_table_pic_header'>
-                                                [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
+                                                [% ident = attrs.isbn_clean || attrs.upc; %]
                                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
                                                         name='item_jacket' class='result_table_pic' width="55"
-                                                        src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' /></a><br />
-                                                [% END %]
+                                                        onerror='this.style.display="none";'
+                                                        src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/r/[% rec.id | uri %]' /></a><br />
                                             </td>
                                             <td class='result_table_title_cell' name='result_table_title_cell'>
                                                 <div class="bold">