TPAC: Display full publication info
[transitory.git] / Open-ILS / src / templates / opac / parts / record / summary.tt2
index 0585f39..b750df6 100644 (file)
@@ -5,62 +5,80 @@
 <!-- ****************** rdetail_summary.xml ***************************** -->
 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% ctx.bre_id %]'></abbr>
 
-[%- IF ctx.refworks.enabled == 'true' %]
-    [% INCLUDE 'opac/parts/record/refworks.tt2' %]
-[%- END %]
-
-<hr style="margin-top: 1em;" />
+<hr />
 
-[%- # This holds the record summary information %]
-<div id="rdetail_image_div" style="float: left; margin-right: 1em;">
-    [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
-    <a href='[% ctx.media_prefix %]/opac/extras/ac/jacket/large/[% ident | 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 %]
-    <br />
-</div>
-<div id="rdetail_actions_div" style="float: right; margin-left: 1em;">
-    <div class="rdetail_aux_utils opac-auto-010">
-        <a href="[% mkurl(ctx.opac_root _ '/place_hold', {hold_target => ctx.bre_id, hold_type => 'T'}) %]" 
-        class="no-dec"><img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" /><span 
-        style="position:relative;top:-3px;left:3px;">[% l('Place Hold') %]</span></a>
+[%-# 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
+            alt="[% l('Image of item') %]" id='rdetail_image'
+            src='[% ctx.media_prefix %]/opac/extras/ac/jacket/[% record.summary.jacket_size %]/[% ident | uri %]' /></a>
+        [% END %]
+        <br />
     </div>
-    <div class="rdetail_aux_utils opac-auto-121">
-    [%-  
-        operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add";
-        label = (operation == "add") ? l("Add to my list") : l("Remove from my list"); 
-    %]
-        <a href="[% ctx.opac_root %]/mylist/[% operation %]?record=[% ctx.bre_id %]" class="no-dec">
+
+    <div id="rdetail_actions_div">
+        [%- search_ou = ctx.search_ou;
+            IF ctx.place_unfillable ||
+                ( attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size > 0
+                    && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
+                )
+         %]
+        <div class="rdetail_aux_utils place_hold">
+            <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
+                {hold_target => ctx.bre_id, hold_type => 'T', hold_source_page => mkurl()}, stop_parms) %]" 
+            class="no-dec"><img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('place hold') %]" /><span 
+            class="place_hold">[% l('Place Hold') %]</span></a>
+        </div>
+        [%- END -%]
+        <div class="rdetail_aux_utils toggle_list">
+        [%  IF ctx.user;
+            INCLUDE "opac/parts/bookbag_actions.tt2";
+        %]
+        [%  ELSE;
+            operation = ctx.mylist.grep(ctx.bre_id).size ? "delete" : "add";
+            label = (operation == "add") ? l("Add to my list") : l("Remove from my list"); 
+        %]
+            <a href="[% mkurl(ctx.opac_root _ '/mylist/' _ operation, {record => ctx.bre_id}, stop_parms) %]" class="no-dec">
+                <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
+                [% label %]
+            </a>
+        [% END %]
+        </div>
+        <div class="rdetail_aux_utils">
             <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
-            [% label %]
-        </a>
+            <a href="[% mkurl(ctx.opac_root _ '/record/print/' _ ctx.bre_id) %]" class="no-dec">[% l('Print') %]</a> /
+            <a href="[% mkurl(ctx.opac_root _ '/record/email/' _ ctx.bre_id) %]" class="no-dec">[% l('Email') %]</a>
+        </div>
+        [%- IF ctx.refworks.enabled == 'true' %]
+            [%- INCLUDE 'opac/parts/record/refworks.tt2' %]
+        [%- END %]
     </div>
-</div>
-
-<div id='rdetail_title_div'>
-    [%- IF attrs.format_icon %]
-    <div style="float:right;margin-right:17px;">
-        <img alt="[% attrs.format_label %]" title="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
+    <div id='rdetail_title_div'>
+        [%- IF attrs.format_icon %]
+        <div class="format_icon">
+            <img alt="[% attrs.format_label %]" title="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
+        </div>
+        [%- END %]
+        <h1 id='rdetail_title' itemprop="name">[% attrs.title_extended | html %]</h1>
+        [%- INCLUDE "opac/parts/record/authors.tt2" %]
     </div>
-    [%- END %]
-    <h1 id='rdetail_title'>[% attrs.title_extended | html %]</h1>
-    [%- INCLUDE "opac/parts/record/authors.tt2" %]
 </div>
 
 [%- IF openurl.enabled == 'true';
-    sfx = []
-    FOR issn IN args.issns;
-        sfx = sfx.import(ResolverResolver.resolve_issn(issn, openurl.baseurl));
+    openurls = [];
+    FOREACH issn IN args.issns;
+        NEXT IF issn == '';
+        openurls = openurls.import(ResolverResolver.resolve_issn(issn, openurl.baseurl));
     END;
-    IF sfx.size && sfx.0 != '';
+    IF openurls.size && openurls.0 != '';
 %]
     <div id='rdetail_openurl'>
         <strong class='rdetail_openurl_title'>[% l("Electronic resources") %]</strong>
         <table><tbody>
 [%-
-        FOR res IN sfx;
+        FOREACH res IN openurls;
 %]
         <tr>
             <td class='rdetail_openurl_entry'><a href="[% res.target_url %]">[% res.public_name %]</a></td>
     [%- END %]
     </tbody></table>
 [%- END %]
-[%- IF sfx.size && sfx.0 != '' %]
     </div>    
 [%- END %]
-[%- FOR uri IN args.uris; %]
-<div class="rdetail_uri">
-    <a href="[% uri.href %]">[% uri.link %]</a>[% ' - ' _ uri.note IF uri.note %]
+[%- merged_uris = args.uris.merge(args.online_res);
+num_uris = merged_uris.size;
+IF num_uris > 0;
+-%]
+<h2 class="rdetail_uris">[% l("Electronic resources") %]</h2>
+<div class="rdetail_uris">
+    [%- IF num_uris > 1 %]<ul>[% END %]
+    [%- FOR uri IN merged_uris %]
+        [%- IF num_uris == 1 %]<p class="rdetail_uri">[% ELSE %]<li class="rdetail_uri">[% END %]
+        <a href="[% uri.href %]">[% uri.link %]</a>[% ' - ' _ uri.note IF uri.note %]
+        [%- IF num_uris == 1 %]</p>[% ELSE %]</li>[% END %]
+    [%- END %]
+    [%- IF num_uris > 1 %]</ul>[% END %]
 </div>
 [%- END %]
-[%- # hold/copy summary %]
-[%- IF ctx.copy_summary.0.count %]
-<div class="rdetail_copy_counts">
-    <span>
-        [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", 
-            ctx.record_hold_count, ctx.copy_summary.0.count) %]
+[%- # Hold/copy summary
+    IF ctx.copy_summary.0.count
+%]
+<div id="copy_hold_counts">
+[%- INCLUDE "opac/parts/record/copy_counts.tt2" %]
+    <span id="rdetail_hold_counts">
+        <h2>[% l('Current holds') %]</h2>
+        <p>
+            [%- l("[quant,_1,current hold,current holds] with [quant,_2,total copy,total copies].", 
+                ctx.record_hold_count, ctx.copy_summary.0.count) %]
+        </p>
     </span>
-    <span>[% l('[quant,_1,copy,copies] currently available.', ctx.copy_summary.0.available) %]</span>
-</div>
-[% END %]
-
-[%- IF ctx.copy_summary.0.count %]
-<div id='rdetail_copies'>
-<h2>[% l('Copies') %]</h2>
-<table cellpadding="0" cellspacing="0" border="0" width="100%" id="rdetails_status">
-    <thead>
-        <tr>
-            <th id='copy_header_library'>[% l("Location") %]</th>
-            <th id='copy_header_callnmber'>[% l("Call Number") %]</th>
-            <th id='copy_header_barcode'>[% l("Barcode") %]</th>
-            <th id='copy_header_shelfloc'>[% l("Shelving Location") %]</th>
-            [%- IF ctx.is_staff %]
-            <th id='copy_header_age_hold'>[% l("Age Hold Protection") %]</th>
-            <th id='copy_header_create_date'>[% l("Create Date") %]</th>
-            <th id='copy_header_holdable'>[% l("Holdable?") %]</th>
-            [%- END %]
-            <th id='copy_header_status'>[% l("Status") %]</th>
-            <th id='copy_header_due_date'>[% l("Due Date") %]</th>
-        </tr>
-    </thead>
-    <tbody class="copy_details_table">
-        [%- last_cn = 0;
-        FOR copy_info IN ctx.copies;
-            NEXT IF copy_info.call_number_label == '##URI##' %]
-        <tr>
-            <td header='copy_header_library'>
-            [%-
-                org_name = ctx.get_aou(copy_info.circ_lib).name;
-                org_name | html
-            -%]
-            </td>
-            <td header='copy_header_callnumber'>[% copy_info.call_number_label | html %]</td>
-            <td header='copy_header_barcode'>[% copy_info.barcode | html %]</td>
-            <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td>
-            [%- IF ctx.is_staff %]
-            <td header='copy_header_age_hold'>
-                [% copy_info.age_protect ?
-                    ctx.get_crahp(copy_info.age_protect).name : l('None') | html %]
-            </td>
-            <td header='copy_header_date_format'>[% date.format(
-                ctx.parse_datetime(copy_info.create_date),
-                DATE_FORMAT
-            ) %]</td>
-            <td header='copy_header_holdable'>[%  # Show copy/volume hold links to staff (without
-                    # checking whether they have permissions to do those).
-                    overall_holdable = (copy_info.holdable == 't' AND
-                        copy_info.location_holdable == 't' AND
-                        copy_info.status_holdable == 't');
-                    IF overall_holdable;
-                        l("Place on"); %]
-                <a href="[% mkurl(ctx.opac_root _ '/place_hold', {hold_target => copy_info.id, hold_type => 'C'}) %]">[% l("copy") %]</a>
-                [%-      IF copy_info.call_number != last_cn;
-                            last_cn = copy_info.call_number;
-                            l(" / "); %]
-                <a href="[% mkurl(ctx.opac_root _ '/place_hold', {hold_target => copy_info.call_number, hold_type => 'V'}) %]">[% l("volume") %]</a>
-                [%-      END;
-                    ELSE;
-                        l("No");
-                    END %]</td>
-            [%- END %]
-            <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
-            <td header='due_date'>[%
-                IF copy_info.due_date;
-                    date.format(
-                        ctx.parse_datetime(copy_info.due_date),
-                        DATE_FORMAT
-                    );
-                ELSE;
-                    '-';
-                END %]</td>
-        </tr>
-        [%- END %]
-        <tr>
-        [%- IF ctx.copy_offset > 0;
-            new_offset = ctx.copy_offset - ctx.copy_limit;
-            IF new_offset < 0; new_offset = 0; END %]
-            <td>
-                <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
-                    l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
-            </td>
-        [%- END %]
-        [%- IF ctx.copies.size >= ctx.copy_limit %]
-            <td>
-                <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
-                    l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
-            </td>
-        [%- END %]
-        </tr>
-        <tr>
-            <td>
-                [%- more_copies_limit = 50 %] [%# TODO: config %]
-                [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
-                    <div style='margin-top:10px;'>
-                        <img src="[% ctx.media_prefix %]/images/plus_sign.png" />
-                        <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
-                    </div>
-                [%- ELSIF ctx.copy_limit == more_copies_limit %]
-                    <div style='margin-top:10px;'>
-                        <img src="[% ctx.media_prefix %]/images/minus_sign.png" />
-                        <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
-                    </div>
-                [%- END %]
-            </td>
-        </tr>
-    </tbody>
-</table>
+[%- INCLUDE "opac/parts/record/copy_table.tt2" copies=ctx.copies %]
 </div>
 [%- END %]
 
     [%- IF attrs.isbns.0; FOR isbn IN attrs.isbns %]
     <li class='rdetail_isbns'>
         <strong class='rdetail_label'>[% l('ISBN:'); %]</strong>
-        <span class='rdetail_value'>[% isbn | html  %]</span>
+        <span class='rdetail_value' itemprop='isbn'>[% isbn | html  %]</span>
     </li>
         [%- END %]
     [%- END %]
     [%- IF attrs.publisher %]
     <li id='rdetail_publisher'>
         <strong class='rdetail_label'>[% l("Publisher:") %]</strong>
-        <span class='rdetail_value'>[% attrs.publisher | html %] [% IF attrs.pubdate; attrs.pubdate | html; END %]</span>
+        <span class='rdetail_value' itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
+        [%- IF attrs.pubplace; %]
+            <span itemprop="location">[% attrs.pubplace | html; %]</span>
+        [%- END; %]
+            <span itemprop="name">[% attrs.publisher | html; %]</span>
+        </span>
+        [%- IF attrs.pubdate; %]
+            <span itemprop="datePublished">[% attrs.pubdate | html; %]</span>
+        [%- END; %]
     </li>
     [%- END %]
 </ul>
 
 [%- INCLUDE "opac/parts/record/subjects.tt2" %]
 [%- INCLUDE "opac/parts/record/series.tt2" %]
+[%- INCLUDE "opac/parts/record/extras.tt2" %]