b7e526fba97c87de6364e1d63b4808e3d487508e
[transitory.git] / Open-ILS / src / templates / opac / parts / result / table.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2
3     USE ResolverResolver;
4
5     ctx.result_start = 1 + ctx.page_size * page;
6     ctx.result_stop = ctx.page_size * (page + 1);
7     IF ctx.result_stop > ctx.hit_count; ctx.result_stop = ctx.hit_count; END;
8
9     result_count = ctx.result_start;
10
11 %]
12
13 [% PROCESS "opac/parts/result/paginate.tt2" %] 
14 [% ctx.results_count_header = PROCESS results_count_header;
15     ctx.results_count_header %]
16
17 [% IF ctx.bookbag %]
18 <div id="result-bookbag-heading">
19     <div class="result-bookbag-name">[% ctx.bookbag.name | html %]</div>
20     <div class="result-bookbag-description">[% ctx.bookbag.description | html %]</div>
21 </div>
22 [% END %]
23 <div id="result_table_div">
24             <div class="facet_sidebar">
25                 [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
26                 [% INCLUDE 'opac/parts/result/facets.tt2' %]
27             </div>
28             <div class="result_block">
29                 <table cellpadding="0" cellspacing="0"
30                     border="0" style="margin-top:10px;">
31                     <tbody id="result_table">
32                     [%  FOR rec IN ctx.records;
33                             attrs = {marc_xml => rec.marc_xml};
34                             PROCESS get_marc_attrs args=attrs;
35                             IF CGI.param('detail_record_view');
36                                 attrs.title = attrs.title_extended;
37                             END;
38                     -%]
39                         <tr class="result_table_row">
40                                             <td class="results_row_count" name="results_row_count">[%
41                                                     result_count; result_count = result_count + 1
42                                                 %].</td>
43                                             <td class='result_table_pic_header'>
44                                                 [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
45                                                 <a href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"><img alt="[% l('Image of item') %]"
46                                                         name='item_jacket' class='result_table_pic' width="55"
47                                                         src='[% ctx.media_prefix %]/opac/extras/ac/jacket/small/[% ident | uri %]' /></a><br />
48                                                 [% END %]
49                                             </td>
50                                             <td class='result_table_title_cell' name='result_table_title_cell'>
51                                                 <div class="bold">
52                                                     <a name='record_[% rec.id %]' name='item_title'
53                                                         href="[% mkurl(ctx.opac_root _ '/record/' _ rec.id) %]"
54                                                         [% HTML.attributes(title => l('Display record details for "[_1]"', attrs.title)) %]
55                                                         class='search_link'>[% attrs.title | html %]</a>
56                                                 </div>
57                                                 <div>
58                                                     <div>
59                                                         <em><a title="[% l("Perform an Author Search") %]"
60                                                                 name='item_author'
61                                                                 href="[%- 
62                                                                     authorquery = attrs.author | replace('[,\.:;]', '');
63                                                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery}, ['page'])
64                                                                     -%]">[% attrs.author | html %]</a></em>
65                                                     </div>
66                                                     <table cellpadding="0" cellspacing="0" border="0"
67                                                         class="results_info_table">
68                                                         [% IF args.holdings.size > 0 %]
69                                                         <tr name='bib_cn_list' class='result_table_title_cell'>
70                                                             <td valign='top'>
71                                                                 <strong>[% l('Call number:') %]</strong>
72                                                             </td>
73                                                             <td>[% args.holdings.0.label | html %]</td>
74                                                         </tr>
75                                                         [% END %]
76
77                                                         [% IF CGI.param('detail_record_view') %]
78                                                         <!-- These fields are visible when viewing the results page in 'detailed' mode -->
79
80                                                         [% IF attrs.pubinfo %]
81                                                             <tr name="results_pub_tr">
82                                                                 <td valign="top">
83                                                                     <strong>[% l('Publisher:') %]</strong>
84                                                                 </td>
85                                                                 <td>[% attrs.pubinfo | html %]</td>
86                                                             </tr>
87                                                         [% END %]
88                                                         [% IF attrs.isbns.size > 0 %]
89                                                             <tr name="results_isbn_tr">
90                                                                 <td valign="top">
91                                                                     <strong>[% l('ISBN:') %]</strong>
92                                                                 </td>
93                                                                 <td>[% attrs.isbns.0 | html %]</td>
94                                                             </tr>
95                                                         [% END %]
96                                                         [%- IF openurl.enabled == 'true';
97                                                             FOREACH issn IN args.issns;
98                                                                 NEXT IF issn == '';
99                                                                 res_urls = ResolverResolver.resolve_issn(issn, openurl.baseurl);
100                                                                 FOREACH res IN res_urls;
101                                                         %]
102                                                         <tr name="results_issn_tr">
103                                                             <td valign="top">
104                                                                 <strong><a href="[% res.target_url %]">
105                                                                 [% res.public_name | html %]</a></strong>
106                                                             </td>
107                                                             <td>[% res.target_coverage | html %]</td>
108                                                         </tr>
109                                                                 [% END %]
110                                                             [% END %]
111                                                         [% END %]
112
113                                                         [% IF attrs.edition %]
114                                                             <tr name="results_edition_tr">
115                                                                 <td valign="top">
116                                                                     <strong>[% l('Edition:') %]</strong>
117                                                                 </td>
118                                                                 <td>[% attrs.edition | html %]</td>
119                                                             </tr>
120                                                         [% END %]
121                                                         [% IF attrs.phys_desc %]
122                                                             <tr name="results_phys_desc_tr">
123                                                                 <td nowrap="nowrap" valign="top">
124                                                                     <strong>[% l('Phys. Desc.:') %]</strong>
125                                                                 </td>
126                                                                 <td>
127                                                                     [% args.phys_desc | html %]
128                                                                 </td>
129                                                             </tr>
130                                                         [% END %]
131                                                         [% FOR uri IN args.uris %]
132                                                             <tr name='bib_uri_list' class='result_table_title_cell'>
133                                                                 <td valign='top'>
134                                                                     <strong>[% l('Electronic resource') %]</strong>
135                                                                 </td>
136                                                                 <td><a href="[% uri.href %]">[% uri.link | html %]</a>[% ' - ' _ uri.note | html IF uri.note %]</td>
137                                                             </tr>
138                                                             [% END %]
139                                                             [%- IF args.holdings.size > 0;
140                                                                 FOREACH copy IN args.holdings;
141                                                                     IF copy.part_label != '';
142                                                                         has_parts = 'true';
143                                                                         LAST;
144                                                                     END;
145                                                                 END;
146                                                             %]
147                                                             <tr name='bib_cn_list' class='result_table_title_cell'>
148                                                                 <td colspan='2'>
149                                                                     <table class='result_holdings_table'>
150                                                                         <thead><tr>
151                                                                             <th>[% l('Library') %]</th>
152                                                                             <th>[% l('Shelving location') %]</th>
153                                                                             <th>[% l('Call number') %]</th>
154                                                                             [%- IF has_parts == 'true'; %]
155                                                                             <th>[% l('Part') %]</th>
156                                                                             [%- END %]
157                                                                             <th>[% l('Status') %]</th>
158                                                                         </tr></thead>
159                                                                         <tbody>
160                                                                 [% FOR copy IN args.holdings %]
161                                                                         <tr>
162                                                                             <td>[% copy.library | html %]</td>
163                                                                             <td>[% copy.location | html %]</td>
164                                                                             <td>[% copy.label | html %]</td>
165                                                                             [%- IF has_parts == 'true'; %]
166                                                                             <td>[% copy.part_label %]</td>
167                                                                             [%- END %]
168                                                                             <td>[% copy.status | html %]</td>
169                                                                         </tr>
170                                                                 [% END %]
171                                                                         </tbody>
172                                                                     </table>
173                                                                 </td>
174                                                             </tr>
175                                                             [%- has_parts = 'false';
176                                                                 END;
177                                                              %]
178                                                         [% END %] <!-- END detail_record_view -->
179                                                     </table>
180                                                     [% PROCESS "opac/parts/result/copy_counts.tt2" %]
181                                                     [% IF rec.user_circulated %]
182                                                     <div class="result_item_circulated">
183                                                         <img src="[% ctx.media_prefix %]/images/green_check.png" alt="[% l('Checked Out Before') %]"/>
184                                                         <span>[% l('I have checked this item out before') %]</span>
185                                                     </div>
186                                                     [% END %]
187                                                     [% IF ctx.bookbag;
188                                                         rec_id = rec.id;
189                                                         FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
190                                                     <div class="result-bookbag-item-note">
191                                                         [% note.note | html %]
192                                                     </div>
193                                                         [% END %]
194                                                     [% END %]
195                                                 </div>
196                                             </td>
197
198                                             <td name='result_table_format_cell' class='result_table_format_cell' width="1">
199
200                                                 [% IF attrs.format_icon %]
201                                                 <img title="[% attrs.format_label | html %]" alt="[% attrs.format_label | html %]" src="[% attrs.format_icon %]" />
202                                                 [% END %]
203
204                                                 <!-- unAPI link -->
205                                                 <abbr class="unapi-id" title='tag:[% ctx.hostname %],[% date.format(date.now, '%Y') %]:biblio-record_entry/[% rec.id %]'></abbr>
206
207                                                 <!-- Empty span used for creating Google Book Search-->
208                                                 <span name="googleBooksLink" class="hide_me">
209                                                     <a style='padding-left: 8px;'
210                                                         class='classic_link hide_me'
211                                                         name="googleBooks-link">[% l("Browse in Google Books Search") %]</a>
212                                                 </span>
213                                             </td>
214                                             <td nowrap='nowrap' width="1" align="right">
215                                                 <div class="result_table_utils_cont">
216                                                     <div class="result_table_utils">
217 [%- search_ou = ctx.search_ou;
218     num_holdable_copies = attrs.marc_xml.findnodes('//*[local-name()="holdings" and @has_holdable="true"]').size || 0;
219     IF ctx.place_unfillable ||
220         ( num_holdable_copies > 0
221             && (ctx.holds_block.enabled != 'true' || attrs.org_copy_counts.$search_ou.available == 0)
222         )
223 %]
224                                                         <div class="results_aux_utils place_hold"><a
225                                                                 href="[% mkurl(ctx.opac_root _ '/place_hold', 
226                                                                     {hold_target => rec.id, hold_type => 'T', hold_source_page => mkurl()}) %]" 
227                                                                     name="place_hold_link" class="no-dec"><img
228                                                                 src="[% ctx.media_prefix %]/images/green_check.png"
229                                                                 alt=""/><span class="result_place_hold">[% l('Place Hold') %]</span></a>
230                                                         </div>
231 [%- END -%]
232                                                         <div class="results_aux_utils result_util">
233                                                             [%  IF ctx.user;
234                                                                 INCLUDE "opac/parts/bookbag_actions.tt2";
235                                                             %]
236                                                             [%  ELSE;
237                                                                 operation = ctx.mylist.grep(rec.id).size ? "delete" : "add";
238                                                                 label = (operation == "add") ? l("Add to my list") : l("Remove from my list");
239                                                                 href = mkurl(ctx.opac_root _ '/mylist/' _ operation, 
240                                                                         {record => rec.id, anchor => 'record_' _ rec.id}, 1);
241                                                             %]      
242                                                             <a href="[% href %]" class="no-dec">
243                                                                 <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
244                                                                 [% label %]
245                                                             </a>
246                                                             [% END %]
247                                                         </div>
248                                                         [% IF ENV.OILS_CONTENT_CAFE_USER %]
249                                                         <div class="results_aux_utils result_util">
250                                                             <a title="[% l('Reviews and More') %]" target='_blank' 
251                                                                 href="[% ctx.proto %]://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=[%- 
252                                                                     ENV.OILS_CONTENT_CAFE_USER %]&amp;Password=[%-
253                                                                     ENV.OILS_CONTENT_CAFE_PASS %]&amp;ItemKey=[% ident | uri %]&Options=Y">
254                                                                 <img src='[% ctx.media_prefix %]/images/starz.png'/> 
255                                                                 <span class="results_reviews">[% l('Reviews &amp; More') %]</span>
256                                                             </a>
257                                                         </div>
258                                                         [% END %]
259                                                     </div>
260                                                 </div>
261                                             </td>
262                                         </tr>
263                                         [%- IF ENV.OILS_CHILIFRESH_ACCOUNT %]
264                                         <tr>
265                                             <td/>
266                                             <td align='center'> <!-- Chilifresh reviews link --> 
267                                                 <span class="chili_review" id="isbn_[% attrs.isbn_clean | html %]"> </span>
268                                             </td>
269                                         </tr>
270                                         <tr>
271                                             <td/>
272                                             <td colspan='5'> <!-- Chilifresh reviews panel -->
273                                                 <div id="chili_review_[% attrs.isbn_clean | html %]" style="display: none;" align="center"></div>
274                                             </td>
275                                         </tr>
276                                         [%- END %]
277                     [% END %]
278                     </tbody>
279                 </table>
280             </div>
281 </div>
282 <div>
283     [% ctx.results_count_header %]
284 </div>